home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Standards 1994 January / InfoMagic Standards - January 1994.iso / inet / doc / zen10.tar / zen-1.0 / texinfo.tex < prev    next >
Text File  |  1992-02-02  |  104KB  |  3,223 lines

  1. %% TeX macros to handle texinfo files
  2.  
  3. %   Copyright (C) 1985, 1986, 1988, 1990, 1991 Free Software Foundation, Inc.
  4.  
  5. %This texinfo.tex file is free software; you can redistribute it and/or
  6. %modify it under the terms of the GNU General Public License as
  7. %published by the Free Software Foundation; either version 2, or (at
  8. %your option) any later version.
  9.  
  10. %This texinfo.tex file is distributed in the hope that it will be
  11. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  12. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. %General Public License for more details.
  14.  
  15. %You should have received a copy of the GNU General Public License
  16. %along with this texinfo.tex file; see the file COPYING.  If not, write
  17. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  18. %USA.
  19.  
  20.  
  21. %In other words, you are welcome to use, share and improve this program.
  22. %You are forbidden to forbid anyone else to use, share and improve
  23. %what you give them.   Help stamp out software-hoarding!
  24.  
  25. \def\texinfoversion{2.60}
  26. \message{Loading texinfo package [Version \texinfoversion]:}
  27. \message{}
  28.  
  29. % Print the version number if in a .fmt file.
  30. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  31.  
  32. % Save some parts of plain tex whose names we will redefine.
  33.  
  34. \let\ptexlbrace=\{
  35. \let\ptexrbrace=\}
  36. \let\ptexdots=\dots
  37. \let\ptexdot=\.
  38. \let\ptexstar=\*
  39. \let\ptexend=\end
  40. \let\ptexbullet=\bullet
  41. \let\ptexb=\b
  42. \let\ptexc=\c
  43. \let\ptexi=\i
  44. \let\ptext=\t
  45. \let\ptexl=\l
  46. \let\ptexL=\L
  47.  
  48. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  49.  
  50. \message{Basics,}
  51. \chardef\other=12
  52.  
  53. \hyphenation{ap-pen-dix}
  54. \hyphenation{mini-buf-fer mini-buf-fers}
  55. \hyphenation{eshell}
  56.  
  57. % Margin to add to right of even pages, to left of odd pages.
  58. \newdimen \bindingoffset  \bindingoffset=0pt
  59. \newdimen \normaloffset   \normaloffset=\hoffset
  60. \newdimen\pagewidth \newdimen\pageheight
  61. \pagewidth=\hsize \pageheight=\vsize
  62.  
  63. %---------------------Begin change-----------------------
  64. %
  65. %%%% For @cropmarks command.
  66. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  67. %
  68. \newdimen\cornerlong \newdimen\cornerthick
  69. \newdimen \topandbottommargin
  70. \newdimen \outerhsize \newdimen \outervsize
  71. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  72. \outerhsize=7in
  73. %\outervsize=9.5in
  74. % Alternative @smallbook page size is 9.25in
  75. \outervsize=9.25in
  76. \topandbottommargin=.75in
  77. %
  78. %---------------------End change-----------------------
  79.  
  80. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  81. % does insertions itself, but you have to call it yourself.
  82. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  83. \def\onepageout#1{\hoffset=\normaloffset
  84. \ifodd\pageno  \advance\hoffset by \bindingoffset
  85. \else \advance\hoffset by -\bindingoffset\fi
  86. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  87. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  88. {\let\hsize=\pagewidth \makefootline}}}%
  89. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  90.  
  91. %%%% For @cropmarks command %%%%
  92.  
  93. % Here is a modification of the main output routine for Near East Publications
  94. % This provides right-angle cropmarks at all four corners.
  95. % The contents of the page are centerlined into the cropmarks,
  96. % and any desired binding offset is added as an \hskip on either
  97. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  98. %
  99. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  100.          \shipout
  101.          \vbox to \outervsize{\hsize=\outerhsize
  102.                  \vbox{\line{\ewtop\hfill\ewtop}}
  103.                  \nointerlineskip
  104.                  \line{\vbox{\moveleft\cornerthick\nstop}
  105.                        \hfill
  106.                        \vbox{\moveright\cornerthick\nstop}}
  107.                  \vskip \topandbottommargin
  108.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  109.             \vbox{
  110.             {\let\hsize=\pagewidth \makeheadline}
  111.             \pagebody{#1}
  112.             {\let\hsize=\pagewidth \makefootline}}
  113.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  114.          \vskip \topandbottommargin plus1fill minus1fill
  115.                  \boxmaxdepth\cornerthick
  116.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  117.                        \hfill
  118.                        \vbox{\moveright\cornerthick\nsbot}}
  119.                  \nointerlineskip
  120.                  \vbox{\line{\ewbot\hfill\ewbot}}
  121.     }
  122.   \advancepageno 
  123.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  124. %
  125. % Do @cropmarks to get crop marks
  126. \def\cropmarks{\let\onepageout=\croppageout }
  127.  
  128. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  129. {\catcode`\@ =11
  130. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  131. \dimen@=\dp#1 \unvbox#1
  132. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  133. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  134. }
  135.  
  136. %
  137. % Here are the rules for the cropmarks.  Note that they are
  138. % offset so that the space between them is truly \outerhsize or \outervsize
  139. % (P. A. MacKay, 12 November, 1986)
  140. %
  141. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  142. \def\nstop{\vbox
  143.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  144. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  145. \def\nsbot{\vbox
  146.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  147.  
  148. % Parse an argument, then pass it to #1.
  149. % The argument can be delimited with [...] or with "..." or braces
  150. % or it can be a whole line.
  151. % #1 should be a macro which expects
  152. % an ordinary undelimited TeX argument.
  153.  
  154. \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
  155.  
  156. \def\parseargx{%
  157. \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
  158. \aftergroup \parseargline %
  159. \fi \endgroup}
  160.  
  161. {\obeyspaces %
  162. \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
  163.  
  164. \gdef\obeyedspace{\ }
  165.  
  166. \def\parseargline{\begingroup \obeylines \parsearglinex}
  167. {\obeylines %
  168. \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
  169.  
  170. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  171.  
  172. %% These are used to keep @begin/@end levels from running away
  173. %% Call \inENV within environments (after a \begingroup)
  174. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  175. \def\ENVcheck{%
  176. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  177. \endgroup\fi} % This is not perfect, but it should reduce lossage
  178.  
  179. % @begin foo  is the same as @foo, for now.
  180. \newhelp\EMsimple{Type <Return> to continue}
  181.  
  182. \outer\def\begin{\parsearg\beginxxx}
  183.  
  184. \def\beginxxx #1{%
  185. \expandafter\ifx\csname #1\endcsname\relax
  186. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  187. \csname #1\endcsname\fi}
  188.  
  189. %% @end foo executes the definition of \Efoo.
  190. %% foo can be delimited by doublequotes or brackets.
  191.  
  192. \def\end{\parsearg\endxxx}
  193.  
  194. \def\endxxx #1{%
  195. \expandafter\ifx\csname E#1\endcsname\relax
  196. \expandafter\ifx\csname #1\endcsname\relax
  197. \errmessage{Undefined command @end #1}\else
  198. \errorE{#1}\fi\fi
  199. \csname E#1\endcsname}
  200. \def\errorE#1{
  201. {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
  202.  
  203. % Single-spacing is done by various environments.
  204.  
  205. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  206. \def\singlespace{%
  207. {\advance \baselineskip by -\singlespaceskip
  208. \kern \baselineskip}%
  209. \baselineskip=\singlespaceskip
  210. }
  211.  
  212. %% Simple single-character @ commands
  213.  
  214. % @@ prints an @
  215. % Kludge this until the fonts are right (grr).
  216. \def\@{{\tt \char '100}}
  217.  
  218. % Define @` and @' to be the same as ` and '
  219. % but suppressing ligatures.
  220. \def\`{{`}}
  221. \def\'{{'}}
  222.  
  223. % Used to generate quoted braces.
  224.  
  225. \def\mylbrace {{\tt \char '173}}
  226. \def\myrbrace {{\tt \char '175}}
  227. \let\{=\mylbrace
  228. \let\}=\myrbrace
  229.  
  230. % @: forces normal size whitespace following.
  231. \def\:{\spacefactor=1000 }
  232.  
  233. % @* forces a line break.
  234. \def\*{\hfil\break\hbox{}\ignorespaces}
  235.  
  236. % @. is an end-of-sentence period.
  237. \def\.{.\spacefactor=3000 }
  238.  
  239. % @w prevents a word break
  240. \def\w #1{\hbox{#1}}
  241.  
  242. % @group ... @end group  forces ... to be all on one page.
  243.  
  244. \def\group{\begingroup% \inENV ???
  245. \ifnum\catcode13=\active \else
  246. \errmessage{@group invalid in context where filling is enabled}\fi
  247. \def \Egroup{\egroup\endgroup}
  248. \vbox\bgroup}
  249.  
  250. % @need space-in-mils
  251. % forces a page break if there is not space-in-mils remaining.
  252.  
  253. \newdimen\mil  \mil=0.001in
  254.  
  255. \def\need{\parsearg\needx}
  256.  
  257. \def\needx #1{\par %
  258. % This method tries to make TeX break the page naturally
  259. % if the depth of the box does not fit.
  260. {\baselineskip=0pt%
  261. \vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  262. \prevdepth=-1000pt
  263. }}
  264.  
  265. % @br   forces paragraph break
  266.  
  267. \let\br = \par
  268.  
  269. % @dots{}  output some dots
  270.  
  271. \def\dots{$\ldots$}
  272.  
  273. % @page    forces the start of a new page
  274.  
  275. \def\page{\par\vfill\supereject}
  276.  
  277. % @exdent text....
  278. % outputs text on separate line in roman font, starting at standard page margin
  279.  
  280. \def\exdent{\errmessage{@exdent in filled text}}
  281.   % @lisp, etc, define \exdent locally from \internalexdent
  282.  
  283. {\obeyspaces
  284. \gdef\internalexdent{\parsearg\exdentzzz}}
  285.  
  286. \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
  287. \advance \hsize by -\leftskip
  288. \advance \hsize by -\rightskip
  289. \leftline{{\rm#1}}}}
  290.  
  291. % @include file    insert text of that file as input.
  292.  
  293. \def\include{\parsearg\includezzz}
  294. \def\includezzz #1{{\def\thisfile{#1}\input #1
  295. }}
  296.  
  297. \def\thisfile{}
  298.  
  299. % @center line   outputs that line, centered
  300.  
  301. \def\center{\parsearg\centerzzz}
  302. \def\centerzzz #1{{\advance\hsize by -\leftskip
  303. \advance\hsize by -\rightskip
  304. \centerline{#1}}}
  305.  
  306. % @sp n   outputs n lines of vertical space
  307.  
  308. \def\sp{\parsearg\spxxx}
  309. \def\spxxx #1{\par \vskip #1\baselineskip}
  310.  
  311. % @comment ...line which is ignored...
  312. % @c is the same as @comment
  313. % @ignore ... @end ignore  is another way to write a comment
  314.  
  315. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  316. \parsearg \commentxxx}
  317.  
  318. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  319.  
  320. \let\c=\comment
  321.  
  322. % Prevent errors for section commands.
  323. % Used in @ignore and in failing conditionals.
  324. \def\ignoresections{%
  325. \let\chapter=\relax
  326. \let\unnumbered=\relax
  327. \let\top=\relax
  328. \let\unnumberedsec=\relax
  329. \let\unnumberedsection=\relax
  330. \let\unnumberedsubsec=\relax
  331. \let\unnumberedsubsection=\relax
  332. \let\unnumberedsubsubsec=\relax
  333. \let\unnumberedsubsubsection=\relax
  334. \let\section=\relax
  335. \let\subsec=\relax
  336. \let\subsubsec=\relax
  337. \let\subsection=\relax
  338. \let\subsubsection=\relax
  339. \let\appendix=\relax
  340. \let\appendixsec=\relax
  341. \let\appendixsection=\relax
  342. \let\appendixsubsec=\relax
  343. \let\appendixsubsection=\relax
  344. \let\appendixsubsubsec=\relax
  345. \let\appendixsubsubsection=\relax
  346. \let\contents=\relax
  347. \let\smallbook=\relax
  348. \let\titlepage=\relax
  349. }
  350.  
  351. \def\ignore{\begingroup\ignoresections
  352. % Make sure that spaces turn into tokens that match what \ignorexxx wants.
  353. \catcode32=10
  354. \ignorexxx}
  355. \long\def\ignorexxx #1\end ignore{\endgroup\ignorespaces}
  356.  
  357. \def\direntry{\begingroup\direntryxxx}
  358. \long\def\direntryxxx #1\end direntry{\endgroup\ignorespaces}
  359.  
  360. % Conditionals to test whether a flag is set.
  361.  
  362. \def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
  363.  
  364. \def\ifsetxxx #1{\endgroup
  365. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\ifsetfail
  366. \else \let\temp=\relax \fi
  367. \temp}
  368. \def\Eifset{}
  369. \def\ifsetfail{\begingroup\ignoresections\ifsetfailxxx}
  370. \long\def\ifsetfailxxx #1\end ifset{\endgroup\ignorespaces}
  371.  
  372. \def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
  373.  
  374. \def\ifclearxxx #1{\endgroup
  375. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\relax
  376. \else \let\temp=\ifclearfail \fi
  377. \temp}
  378. \def\Eifclear{}
  379. \def\ifclearfail{\begingroup\ignoresections\ifclearfailxxx}
  380. \long\def\ifclearfailxxx #1\end ifclear{\endgroup\ignorespaces}
  381.  
  382. % @set foo     to set the flag named foo.
  383. % @clear foo   to clear the flag named foo.
  384. \def\set{\parsearg\setxxx}
  385. \def\setxxx #1{
  386. \expandafter\let\csname IF#1\endcsname=\set}
  387.  
  388. \def\clear{\parsearg\clearxxx}
  389. \def\clearxxx #1{
  390. \expandafter\let\csname IF#1\endcsname=\relax}
  391.  
  392. % Some texinfo constructs that are trivial in tex
  393.  
  394. \def\iftex{}
  395. \def\Eiftex{}
  396. \def\ifinfo{\begingroup\ignoresections\ifinfoxxx}
  397. \long\def\ifinfoxxx #1\end ifinfo{\endgroup\ignorespaces}
  398.  
  399. \long\def\menu #1\end menu{}
  400. \def\asis#1{#1}
  401.  
  402. % @math means output in math mode.
  403. % We don't use $'s directly in the definition of \math because control
  404. % sequences like \math are expanded when the toc file is written.  Then,
  405. % we read the toc file back, the $'s will be normal characters (as they
  406. % should be, according to the definition of Texinfo).  So we must use a
  407. % control sequence to switch into and out of math mode.
  408. % This isn't quite enough for @math to work properly in indices, but it
  409. % seems unlikely it will ever be needed there.
  410. \let\implicitmath = $
  411. \def\math#1{\implicitmath #1\implicitmath}
  412.  
  413. \def\node{\ENVcheck\parsearg\nodezzz}
  414. \def\nodezzz#1{\nodexxx [#1,]}
  415. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  416. \let\lastnode=\relax
  417.  
  418. \def\donoderef{\ifx\lastnode\relax\else
  419. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  420. \let\lastnode=\relax}
  421.  
  422. \def\unnumbnoderef{\ifx\lastnode\relax\else
  423. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  424. \let\lastnode=\relax}
  425.  
  426. \def\appendixnoderef{\ifx\lastnode\relax\else
  427. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  428. \let\lastnode=\relax}
  429.  
  430. \let\refill=\relax
  431.   
  432. % @setfilename is done at the beginning of every texinfo file.
  433. % So open here the files we need to have open while reading the input.
  434. % This makes it possible to make a .fmt file for texinfo.
  435. \def\setfilename{%
  436.    \readauxfile
  437.    \opencontents
  438.    \openindices
  439.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  440.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  441.    \comment % Ignore the actual filename.
  442. }
  443.  
  444. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  445.  
  446. \def\inforef #1{\inforefzzz #1,,,,**}
  447. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}},
  448.   node \samp{\losespace#1{}}}
  449. \def\losespace #1{#1}
  450.  
  451. \message{fonts,}
  452.  
  453. % Font-change commands.
  454.  
  455. % Texinfo supports the sans serif font style, which plain TeX does not.
  456. % So we set up a \sf analogous to plain's \rm, etc.
  457. \newfam\sffam
  458. \def\sf{\fam=\sffam \tensf}
  459. \let\li = \sf % Sometimes we call it \li, not \sf.
  460.  
  461. %% Try out Computer Modern fonts at \magstephalf
  462. \let\mainmagstep=\magstephalf
  463.  
  464. \ifx\bigger\relax
  465. \let\mainmagstep=\magstep1
  466. \font\textrm=cmr12
  467. \font\texttt=cmtt12
  468. \else
  469. \font\textrm=cmr10 scaled \mainmagstep
  470. \font\texttt=cmtt10 scaled \mainmagstep
  471. \fi
  472. % Instead of cmb10, you many want to use cmbx10.
  473. % cmbx10 is a prettier font on its own, but cmb10
  474. % looks better when embedded in a line with cmr10.
  475. \font\textbf=cmb10 scaled \mainmagstep 
  476. \font\textit=cmti10 scaled \mainmagstep
  477. \font\textsl=cmsl10 scaled \mainmagstep
  478. \font\textsf=cmss10 scaled \mainmagstep
  479. \font\textsc=cmcsc10 scaled \mainmagstep
  480. \font\texti=cmmi10 scaled \mainmagstep
  481. \font\textsy=cmsy10 scaled \mainmagstep
  482.  
  483. % A few fonts for @defun, etc.
  484. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  485. \font\deftt=cmtt10 scaled \magstep1
  486. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  487.  
  488. % Fonts for indices and small examples.
  489. % We actually use the slanted font rather than the italic, 
  490. % because texinfo normally uses the slanted fonts for that.
  491. % Do not make many font distinctions in general in the index, since they
  492. % aren't very useful.
  493. \font\ninett=cmtt9
  494. \font\indrm=cmr9
  495. \font\indit=cmsl9
  496. \let\indsl=\indit
  497. \let\indtt=\ninett
  498. \let\indsf=\indrm
  499. \let\indbf=\indrm
  500. \let\indsc=\indrm
  501. \font\indi=cmmi9
  502. \font\indsy=cmsy9
  503.  
  504. % Fonts for headings
  505. \font\chaprm=cmbx12 scaled \magstep2
  506. \font\chapit=cmti12 scaled \magstep2
  507. \font\chapsl=cmsl12 scaled \magstep2
  508. \font\chaptt=cmtt12 scaled \magstep2
  509. \font\chapsf=cmss12 scaled \magstep2
  510. \let\chapbf=\chaprm
  511. \font\chapsc=cmcsc10 scaled\magstep3
  512. \font\chapi=cmmi12 scaled \magstep2
  513. \font\chapsy=cmsy10 scaled \magstep3
  514.  
  515. \font\secrm=cmbx12 scaled \magstep1
  516. \font\secit=cmti12 scaled \magstep1
  517. \font\secsl=cmsl12 scaled \magstep1
  518. \font\sectt=cmtt12 scaled \magstep1
  519. \font\secsf=cmss12 scaled \magstep1
  520. \font\secbf=cmbx12 scaled \magstep1
  521. \font\secsc=cmcsc10 scaled\magstep2
  522. \font\seci=cmmi12 scaled \magstep1
  523. \font\secsy=cmsy10 scaled \magstep2
  524.  
  525. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  526. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  527. % \font\ssecsl=cmsl10 scaled \magstep1
  528. % \font\ssectt=cmtt10 scaled \magstep1
  529. % \font\ssecsf=cmss10 scaled \magstep1
  530.  
  531. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  532. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  533. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  534. %\font\ssectt=cmtt10 scaled 1315
  535. %\font\ssecsf=cmss10 scaled 1315
  536.  
  537. %\let\ssecbf=\ssecrm
  538.  
  539. \font\ssecrm=cmbx12 scaled \magstephalf
  540. \font\ssecit=cmti12 scaled \magstephalf
  541. \font\ssecsl=cmsl12 scaled \magstephalf
  542. \font\ssectt=cmtt12 scaled \magstephalf
  543. \font\ssecsf=cmss12 scaled \magstephalf
  544. \font\ssecbf=cmbx12 scaled \magstephalf
  545. \font\ssecsc=cmcsc10 scaled \magstep1 
  546. \font\sseci=cmmi12 scaled \magstephalf
  547. \font\ssecsy=cmsy10 scaled \magstep1
  548. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  549. % but that is not a standard magnification.
  550.  
  551. % Fonts for title page:
  552. \font\titlerm = cmbx12 scaled \magstep3
  553. \let\authorrm = \secrm
  554.  
  555. % In order for the font changes to affect most math symbols and letters,
  556. % we have to define the \textfont of the standard families.  Since
  557. % texinfo doesn't allow for producing subscripts and superscripts, we
  558. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  559. % also require loading a lot more fonts).
  560. \def\resetmathfonts{%
  561.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  562.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  563.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  564. }
  565.  
  566.  
  567. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  568. % of just \STYLE.  We do this so that font changes will continue to work
  569. % in math mode, where it is the current \fam that is relevant in most
  570. % cases, not the current.  Plain TeX does, for example,
  571. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  572. % to redefine \bf itself.  
  573. \def\textfonts{%
  574.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  575.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  576.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  577.   \resetmathfonts}
  578. \def\chapfonts{%
  579.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 
  580.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  581.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  582.   \resetmathfonts}
  583. \def\secfonts{%
  584.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  585.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  586.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  587.   \resetmathfonts}
  588. \def\subsecfonts{%
  589.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  590.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  591.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  592.   \resetmathfonts}
  593. \def\indexfonts{%
  594.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  595.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  596.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  597.   \resetmathfonts}
  598.  
  599. % Set up the default fonts, so we can use them for creating boxes.
  600. \textfonts
  601.  
  602. % Count depth in font-changes, for error checks
  603. \newcount\fontdepth \fontdepth=0
  604.  
  605. % Fonts for short table of contents.
  606. \font\shortcontrm=cmr12
  607. \font\shortcontbf=cmbx12
  608. \font\shortcontsl=cmsl12
  609.  
  610. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  611. %% serif) and @ii for TeX italic
  612.  
  613. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  614. % unless the following character is such as not to need one.
  615. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  616. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  617.  
  618. \let\i=\smartitalic
  619. \let\var=\smartitalic
  620. \let\dfn=\smartitalic
  621. \let\emph=\smartitalic
  622. \let\cite=\smartitalic
  623.  
  624. \def\b#1{{\bf #1}}
  625. \let\strong=\b
  626.  
  627. \def\t#1{{\tt \exhyphenpenalty=10000\rawbackslash \frenchspacing #1}\null}
  628. \let\ttfont = \t
  629. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  630. \def\samp #1{`\tclose{#1}'\null}
  631. \def\key #1{{\tt \exhyphenpenalty=10000\uppercase{#1}}\null}
  632. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  633.  
  634. \let\file=\samp
  635.  
  636. % @code is a modification of @t,
  637. % which makes spaces the same size as normal in the surrounding text.
  638. \newdimen\tclosesave
  639. \newdimen\tcloserm
  640. \def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
  641. \fontdimen2\font=\tcloserm
  642. % prevent breaking lines at hyphens.
  643. \exhyphenpenalty=10000
  644. \def\ {{\fontdimen2\font=\tclosesave{} }}%
  645.  \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
  646. \let\code=\tclose
  647. %\let\exp=\tclose  %Was temporary
  648.  
  649. % @kbd is like @code, except that if the argument is just one @key command, 
  650. % then @kbd has no effect.
  651.  
  652. \def\xkey{\key}
  653. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  654. \ifx\one\xkey\ifx\threex\three \key{#2}%
  655. \else\tclose{\look}\fi
  656. \else\tclose{\look}\fi}
  657.  
  658. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  659. % argument is to make the input look right: @dmn{pt} instead of
  660. % @dmn{}pt.
  661. \def\dmn#1{\thinspace #1}
  662.  
  663. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  664.  
  665. \def\l#1{{\li #1}\null}        % 
  666.  
  667. \def\r#1{{\rm #1}}        % roman font
  668. % Use of \lowercase was suggested.
  669. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  670. \def\ii#1{{\it #1}}        % italic font
  671.  
  672. \message{page headings,}
  673.  
  674. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  675. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  676.  
  677. % First the title page.  Must do @settitle before @titlepage.
  678. \def\titlefont#1{{\titlerm #1}}
  679.  
  680. \newtoks\realeverypar
  681. \newif\ifseenauthor
  682. \newif\iffinishedtitlepage
  683.  
  684. \def\titlepage{\begingroup \parindent=0pt \textfonts
  685.    \let\subtitlerm=\tenrm
  686. % I deinstalled the following change because \cmr12 is undefined.
  687. % This change was not in the ChangeLog anyway.  --rms.
  688. %   \let\subtitlerm=\cmr12
  689.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  690.    %
  691.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  692.    %
  693.    % Leave some space at the very top of the page.
  694.    \vglue\titlepagetopglue
  695.    %
  696.    % Now you can print the title using @title.
  697.    \def\title{\parsearg\titlezzz}%
  698.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  699.             % print a rule at the page bottom also.
  700.             \finishedtitlepagefalse
  701.             \vskip4pt \hrule height 4pt \vskip4pt}%
  702.    % No rule at page bottom unless we print one at the top with @title.
  703.    \finishedtitlepagetrue
  704.    %
  705.    % Now you can put text using @subtitle.
  706.    \def\subtitle{\parsearg\subtitlezzz}%
  707.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  708.    %
  709.    % @author should come last, but may come many times.
  710.    \def\author{\parsearg\authorzzz}%
  711.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  712.       {\authorfont \leftline{##1}}}%
  713.    %  
  714.    % Most title ``pages'' are actually two pages long, with space
  715.    % at the top of the second.  We don't want the ragged left on the second.
  716.    \let\oldpage = \page
  717.    \def\page{%
  718.       \iffinishedtitlepage\else
  719.      \finishtitlepage
  720.       \fi
  721.       \oldpage
  722.       \let\page = \oldpage
  723.       \hbox{}}%
  724. %   \def\page{\oldpage \hbox{}}
  725. }
  726.  
  727. \def\Etitlepage{%
  728.    \iffinishedtitlepage\else
  729.       \finishtitlepage
  730.    \fi
  731.    % It is important to do the page break before ending the group,
  732.    % because the headline and footline are only empty inside the group.
  733.    % If we use the new definition of \page, we always get a blank page
  734.    % after the title page, which we certainly don't want.
  735.    \oldpage
  736.    \endgroup
  737.    \HEADINGSon
  738. }
  739.  
  740. \def\finishtitlepage{%
  741.    \vskip4pt \hrule height 2pt
  742.    \vskip\titlepagebottomglue
  743.    \finishedtitlepagetrue
  744. }
  745.  
  746. %%% Set up page headings and footings.
  747.  
  748. \let\thispage=\folio
  749.  
  750. \newtoks \evenheadline    % Token sequence for heading line of even pages
  751. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  752. \newtoks \evenfootline    % Token sequence for footing line of even pages
  753. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  754.  
  755. % Now make Tex use those variables
  756. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  757.                             \else \the\evenheadline \fi}}
  758. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  759.                             \else \the\evenfootline \fi}\HEADINGShook}
  760. \let\HEADINGShook=\relax
  761.  
  762. % Commands to set those variables.
  763. % For example, this is what  @headings on  does
  764. % @evenheading @thistitle|@thispage|@thischapter
  765. % @oddheading @thischapter|@thispage|@thistitle
  766. % @evenfooting @thisfile||
  767. % @oddfooting ||@thisfile
  768.  
  769. \def\evenheading{\parsearg\evenheadingxxx}
  770. \def\oddheading{\parsearg\oddheadingxxx}
  771. \def\everyheading{\parsearg\everyheadingxxx}
  772.  
  773. \def\evenfooting{\parsearg\evenfootingxxx}
  774. \def\oddfooting{\parsearg\oddfootingxxx}
  775. \def\everyfooting{\parsearg\everyfootingxxx}
  776.  
  777. {\catcode`\@=0 %
  778.  
  779. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  780. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  781. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  782.  
  783. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  784. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  785. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  786.  
  787. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  788. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  789. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  790. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  791.  
  792. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  793. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  794. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  795.  
  796. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  797. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  798. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  799.  
  800. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  801. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  802. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  803. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  804. %
  805. }% unbind the catcode of @.
  806.  
  807. % @headings double    turns headings on for double-sided printing.
  808. % @headings single    turns headings on for single-sided printing.
  809. % @headings off        turns them off.
  810. % @headings on        same as @headings double, retained for compatibility.
  811. % @headings after    turns on double-sided headings after this page.
  812. % @headings doubleafter    turns on double-sided headings after this page.
  813. % @headings singleafter turns on single-sided headings after this page.
  814. % By default, they are off.
  815.  
  816. \def\headings #1 {\csname HEADINGS#1\endcsname}
  817.  
  818. \def\HEADINGSoff{
  819. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  820. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  821. \HEADINGSoff
  822. % When we turn headings on, set the page number to 1.
  823. % For double-sided printing, put current file name in lower left corner,
  824. % chapter name on inside top of right hand pages, document
  825. % title on inside top of left hand pages, and page numbers on outside top
  826. % edge of all pages.
  827. \def\HEADINGSdouble{
  828. %\pagealignmacro
  829. \global\pageno=1
  830. \global\evenfootline={\hfil}
  831. \global\oddfootline={\hfil}
  832. \global\evenheadline={\line{\folio\hfil\thistitle}}
  833. \global\oddheadline={\line{\thischapter\hfil\folio}}
  834. }
  835. % For single-sided printing, chapter title goes across top left of page,
  836. % page number on top right.
  837. \def\HEADINGSsingle{
  838. %\pagealignmacro
  839. \global\pageno=1
  840. \global\evenfootline={\hfil}
  841. \global\oddfootline={\hfil}
  842. \global\evenheadline={\line{\thischapter\hfil\folio}}
  843. \global\oddheadline={\line{\thischapter\hfil\folio}}
  844. }
  845. \def\HEADINGSon{\HEADINGSdouble}
  846.  
  847. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  848. \let\HEADINGSdoubleafter=\HEADINGSafter
  849. \def\HEADINGSdoublex{%
  850. \global\evenfootline={\hfil}
  851. \global\oddfootline={\hfil}
  852. \global\evenheadline={\line{\folio\hfil\thistitle}}
  853. \global\oddheadline={\line{\thischapter\hfil\folio}}
  854. }
  855.  
  856. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  857. \def\HEADINGSsinglex{%
  858. \global\evenfootline={\hfil}
  859. \global\oddfootline={\hfil}
  860. \global\evenheadline={\line{\thischapter\hfil\folio}}
  861. \global\oddheadline={\line{\thischapter\hfil\folio}}
  862. }
  863.  
  864. % Subroutines used in generating headings
  865. % Produces Day Month Year style of output.
  866. \def\today{\number\day\space
  867. \ifcase\month\or
  868. January\or February\or March\or April\or May\or June\or
  869. July\or August\or September\or October\or November\or December\fi
  870. \space\number\year}
  871.  
  872. % Use this if you want the Month Day, Year style of output.
  873. %\def\today{\ifcase\month\or
  874. %January\or February\or March\or April\or May\or June\or
  875. %July\or August\or September\or October\or November\or December\fi
  876. %\space\number\day, \number\year}
  877.  
  878. % @settitle line...  specifies the title of the document, for headings
  879. % It generates no output of its own
  880.  
  881. \def\thistitle{No Title}
  882. \def\settitle{\parsearg\settitlezzz}
  883. \def\settitlezzz #1{\gdef\thistitle{#1}}
  884.  
  885. \message{tables,}
  886.  
  887. % @tabs -- simple alignment
  888.  
  889. % These don't work.  For one thing, \+ is defined as outer.
  890. % So these macros cannot even be defined.
  891.  
  892. %\def\tabs{\parsearg\tabszzz}
  893. %\def\tabszzz #1{\settabs\+#1\cr}
  894. %\def\tabline{\parsearg\tablinezzz}
  895. %\def\tablinezzz #1{\+#1\cr}
  896. %\def\&{&}
  897.  
  898. % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
  899.  
  900. % default indentation of table text
  901. \newdimen\tableindent \tableindent=.8in
  902. % default indentation of @itemize and @enumerate text
  903. \newdimen\itemindent  \itemindent=.3in
  904. % margin between end of table item and start of table text.
  905. \newdimen\itemmargin  \itemmargin=.1in
  906.  
  907. % used internally for \itemindent minus \itemmargin
  908. \newdimen\itemmax
  909.  
  910. % Note @table and @ftable define @item, @itemx, etc., with these defs.
  911. % They also define \itemindex
  912. % to index the item name in whatever manner is desired (perhaps none).
  913.  
  914. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  915. \def\internalBitemx{\par \parsearg\itemzzz}
  916.  
  917. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  918. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  919.  
  920. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  921. \def\internalBkitemx{\par \parsearg\kitemzzz}
  922.  
  923. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  924.                  \itemzzz {#1}}
  925.  
  926. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  927.                  \itemzzz {#1}}
  928.  
  929. \def\itemzzz #1{\begingroup %
  930.   \advance\hsize by -\rightskip
  931.   \advance\hsize by -\leftskip
  932.   \setbox0=\hbox{\itemfont{#1}}%
  933.   \itemindex{#1}%
  934.   %
  935.   % Be sure we are not still in the middle of a paragraph.
  936.   \parskip=0in
  937.   \par
  938.   %
  939.   % If the item text does not fit in the space we have, put it on a line
  940.   % by itself, and do not allow a page break either before or after that
  941.   % line.  We do not start a paragraph here because then if the next
  942.   % command is, e.g., @kindex, the whatsit would get put into the
  943.   % horizontal list on a line by itself, resulting in extra blank space.
  944.   \ifdim \wd0>\itemmax
  945.     \box0
  946.     \nobreak
  947.   \else
  948.     % The item text fits into the space.  Start a paragraph, so that the
  949.     % following text (if any) will end up on the same line.  Since that
  950.     % text will be indented by \tableindent, we make the item text be in
  951.     % a zero-width box.
  952.     \noindent
  953.     \rlap{\hskip -\tableindent\box0}%
  954.   \fi
  955.   \endgroup
  956. }
  957.  
  958. \def\item{\errmessage{@item while not in a table}}
  959. \def\itemx{\errmessage{@itemx while not in a table}}
  960. \def\kitem{\errmessage{@kitem while not in a table}}
  961. \def\kitemx{\errmessage{@kitemx while not in a table}}
  962. \def\xitem{\errmessage{@xitem while not in a table}}
  963. \def\xitemx{\errmessage{@xitemx while not in a table}}
  964.  
  965. %% Contains a kludge to get @end[description] to work
  966. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  967.  
  968. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  969. {\obeylines\obeyspaces%
  970. \gdef\tablex #1^^M{%
  971. \tabley\dontindex#1        \endtabley}}
  972.  
  973. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  974. {\obeylines\obeyspaces%
  975. \gdef\ftablex #1^^M{%
  976. \tabley\fnitemindex#1        \endtabley
  977. \def\Eftable{\endgraf\endgroup\afterenvbreak}%
  978. \let\Etable=\relax}}
  979.  
  980. \def\dontindex #1{}
  981. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  982.  
  983. {\obeyspaces %
  984. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  985. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  986.  
  987. \def\tablez #1#2#3#4#5#6{%
  988. \aboveenvbreak %
  989. \begingroup %
  990. \def\Edescription{\Etable}% Neccessary kludge.
  991. \let\itemindex=#1%
  992. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  993. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  994. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  995. \def\itemfont{#2}%
  996. \itemmax=\tableindent %
  997. \advance \itemmax by -\itemmargin %
  998. \advance \leftskip by \tableindent %
  999. \parindent = 0pt
  1000. \parskip = \smallskipamount
  1001. \ifdim \parskip=0pt \parskip=2pt \fi%
  1002. \def\Etable{\endgraf\endgroup\afterenvbreak}%
  1003. \let\item = \internalBitem %
  1004. \let\itemx = \internalBitemx %
  1005. \let\kitem = \internalBkitem %
  1006. \let\kitemx = \internalBkitemx %
  1007. \let\xitem = \internalBxitem %
  1008. \let\xitemx = \internalBxitemx %
  1009. }
  1010.  
  1011. % This is the counter used by @enumerate, which is really @itemize
  1012.  
  1013. \newcount \itemno
  1014.  
  1015. \def\itemize{\parsearg\itemizezzz}
  1016.  
  1017. \def\itemizezzz #1{%
  1018.   \begingroup % ended by the @end itemsize
  1019.   \itemizey {#1}{\Eitemize}
  1020. }
  1021.  
  1022. \def\itemizey #1#2{%
  1023. \aboveenvbreak %
  1024. \itemmax=\itemindent %
  1025. \advance \itemmax by -\itemmargin %
  1026. \advance \leftskip by \itemindent %
  1027. \parindent = 0pt %
  1028. \parskip = \smallskipamount %
  1029. \ifdim \parskip=0pt \parskip=2pt \fi%
  1030. \def#2{\endgraf\endgroup\afterenvbreak}%
  1031. \def\itemcontents{#1}%
  1032. \let\item=\itemizeitem}
  1033.  
  1034. \def\bullet{$\ptexbullet$}
  1035. \def\minus{$-$}
  1036.  
  1037. % Set sfcode to normal for the chars that usually have another value.
  1038. % These are `.?!:;,'
  1039. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1040.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1041.  
  1042. % \splitoff TOKENS\endmark defines \first to be the first token in
  1043. % TOKENS, and \rest to be the remainder.
  1044. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1045.  
  1046. % Allow an optional argument of an uppercase letter, lowercase letter,
  1047. % or number, to specify the first label in the enumerated list.  No
  1048. % argument is the same as `1'.
  1049. \def\enumerate{\parsearg\enumeratezzz}
  1050. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1051. \def\enumeratey #1 #2\endenumeratey{%
  1052.   \begingroup % ended by the @end enumerate
  1053.   %
  1054.   % If we were given no argument, pretend we were given `1'.
  1055.   \def\thearg{#1}%
  1056.   \ifx\thearg\empty \def\thearg{1}\fi
  1057.   %
  1058.   % Detect if the argument is a single token.  If so, it might be a
  1059.   % letter.  Otherwise, the only valid thing it can be is a number.
  1060.   % (We will always have one token, because of the test we just made.
  1061.   % This is a good thing, since \splitoff doesn't work given nothing at
  1062.   % all -- the first parameter is undelimited.)
  1063.   \expandafter\splitoff\thearg\endmark
  1064.   \ifx\rest\empty
  1065.     % Only one token in the argument.  It could still be anything.
  1066.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1067.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1068.     %   not equal to itself.
  1069.     % Otherwise, we assume it's a number.
  1070.     % 
  1071.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1072.     % continuing to look for a <number>.
  1073.     % 
  1074.     \ifnum\lccode\expandafter`\thearg=0\relax 
  1075.       \numericenumerate % a number (we hope)
  1076.     \else
  1077.       % It's a letter.
  1078.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1079.         \alphaenumerate % lowercase letter
  1080.       \else
  1081.         \capsenumerate % uppercase letter
  1082.       \fi
  1083.     \fi
  1084.   \else
  1085.     % Multiple tokens in the argument.  We hope it's a number.
  1086.     \numericenumerate
  1087.   \fi
  1088. }
  1089.  
  1090. % An @enumerate whose labels are integers.  The starting integer is
  1091. % given in \thearg.
  1092. \def\numericenumerate{%
  1093.   \itemno = \thearg
  1094.   \startenumeration{\the\itemno}%
  1095. }
  1096.  
  1097. % The starting (lowercase) letter is in \thearg.
  1098. \def\alphaenumerate{%
  1099.   \itemno = \expandafter`\thearg
  1100.   \startenumeration{%
  1101.     % Be sure we're not beyond the end of the alphabet.
  1102.     \ifnum\itemno=0
  1103.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1104.                   alphabet}%
  1105.     \fi
  1106.     \char\lccode\itemno
  1107.   }%
  1108. }
  1109.  
  1110. % The starting (uppercase) letter is in \thearg.
  1111. \def\capsenumerate{%
  1112.   \itemno = \expandafter`\thearg
  1113.   \startenumeration{%
  1114.     % Be sure we're not beyond the end of the alphabet.
  1115.     \ifnum\itemno=0
  1116.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1117.                   alphabet}
  1118.     \fi
  1119.     \char\uccode\itemno
  1120.   }%
  1121. }
  1122.  
  1123. % Call itemizey, adding a period to the first argument and supplying the
  1124. % common last two arguments.  Also subtract one from the initial value in
  1125. % \itemno, since @item increments \itemno.
  1126. \def\startenumeration#1{%
  1127.   \advance\itemno by -1
  1128.   \itemizey{#1.}\Eenumerate\flushcr
  1129. }
  1130.  
  1131. % Allow all natural ways of terminating enumerates to work.
  1132. \def\Ealphaenumerate{\Eenumerate}
  1133. \def\Ecapsenumerate{\Eenumerate}
  1134.  
  1135. % Definition of @item while inside @itemize.
  1136.  
  1137. \def\itemizeitem{%
  1138. \advance\itemno by 1
  1139. {\let\par=\endgraf \smallbreak}%
  1140. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1141. {\parskip=0in \hskip 0pt
  1142. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1143. \vadjust{\penalty 300}}%
  1144. \flushcr}
  1145.  
  1146. \message{indexing,}
  1147. % Index generation facilities
  1148.  
  1149. % Define \newwrite to be identical to plain tex's \newwrite
  1150. % except not \outer, so it can be used within \newindex.
  1151. {\catcode`\@=11
  1152. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1153.  
  1154. % \newindex {foo} defines an index named foo.
  1155. % It automatically defines \fooindex such that
  1156. % \fooindex ...rest of line... puts an entry in the index foo.
  1157. % It also defines \fooindfile to be the number of the output channel for
  1158. % the file that    accumulates this index.  The file's extension is foo.
  1159. % The name of an index should be no more than 2 characters long
  1160. % for the sake of vms.
  1161.  
  1162. \def\newindex #1{
  1163. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1164. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1165. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1166. \noexpand\doindex {#1}}
  1167. }
  1168.  
  1169. % @defindex foo  ==  \newindex{foo}
  1170.  
  1171. \def\defindex{\parsearg\newindex}
  1172.  
  1173. % Define @defcodeindex, like @defindex except put all entries in @code.
  1174.  
  1175. \def\newcodeindex #1{
  1176. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1177. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1178. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1179. \noexpand\docodeindex {#1}}
  1180. }
  1181.  
  1182. \def\defcodeindex{\parsearg\newcodeindex}
  1183.  
  1184. % @synindex foo bar    makes index foo feed into index bar.
  1185. % Do this instead of @defindex foo if you don't want it as a separate index.
  1186. \def\synindex #1 #2 {%
  1187. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1188. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1189. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1190. \noexpand\doindex {#2}}%
  1191. }
  1192.  
  1193. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1194. % inside @code.
  1195. \def\syncodeindex #1 #2 {%
  1196. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1197. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1198. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1199. \noexpand\docodeindex {#2}}%
  1200. }
  1201.  
  1202. % Define \doindex, the driver for all \fooindex macros.
  1203. % Argument #1 is generated by the calling \fooindex macro,
  1204. %  and it is "foo", the name of the index.
  1205.  
  1206. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1207. % This is because \doind is more useful to call from other macros.
  1208.  
  1209. % There is also \dosubind {index}{topic}{subtopic}
  1210. % which makes an entry in a two-level index such as the operation index.
  1211.  
  1212. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1213. \def\singleindexer #1{\doind{\indexname}{#1}}
  1214.  
  1215. % like the previous two, but they put @code around the argument.
  1216. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1217. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1218.  
  1219. \def\indexdummies{%
  1220. \def\_{{\realbackslash _}}%
  1221. \def\w{\realbackslash w }%
  1222. \def\bf{\realbackslash bf }%
  1223. \def\rm{\realbackslash rm }%
  1224. \def\sl{\realbackslash sl }%
  1225. \def\sf{\realbackslash sf}%
  1226. \def\tt{\realbackslash tt}%
  1227. \def\gtr{\realbackslash gtr}%
  1228. \def\less{\realbackslash less}%
  1229. \def\hat{\realbackslash hat}%
  1230. \def\char{\realbackslash char}%
  1231. \def\TeX{\realbackslash TeX}%
  1232. \def\dots{\realbackslash dots }%
  1233. \def\copyright{\realbackslash copyright }%
  1234. \def\tclose##1{\realbackslash tclose {##1}}%
  1235. \def\code##1{\realbackslash code {##1}}%
  1236. \def\samp##1{\realbackslash samp {##1}}%
  1237. \def\t##1{\realbackslash r {##1}}%
  1238. \def\r##1{\realbackslash r {##1}}%
  1239. \def\i##1{\realbackslash i {##1}}%
  1240. \def\b##1{\realbackslash b {##1}}%
  1241. \def\cite##1{\realbackslash cite {##1}}%
  1242. \def\key##1{\realbackslash key {##1}}%
  1243. \def\file##1{\realbackslash file {##1}}%
  1244. \def\var##1{\realbackslash var {##1}}%
  1245. \def\kbd##1{\realbackslash kbd {##1}}%
  1246. }
  1247.  
  1248. % \indexnofonts no-ops all font-change commands.
  1249. % This is used when outputting the strings to sort the index by.
  1250. \def\indexdummyfont#1{#1}
  1251. \def\indexdummytex{TeX}
  1252. \def\indexdummydots{...}
  1253.  
  1254. \def\indexnofonts{%
  1255. \let\w=\indexdummyfont
  1256. \let\t=\indexdummyfont
  1257. \let\r=\indexdummyfont
  1258. \let\i=\indexdummyfont
  1259. \let\b=\indexdummyfont
  1260. \let\emph=\indexdummyfont
  1261. \let\strong=\indexdummyfont
  1262. \let\cite=\indexdummyfont
  1263. \let\sc=\indexdummyfont
  1264. %Don't no-op \tt, since it isn't a user-level command
  1265. % and is used in the definitions of the active chars like <, >, |...
  1266. %\let\tt=\indexdummyfont
  1267. \let\tclose=\indexdummyfont
  1268. \let\code=\indexdummyfont
  1269. \let\file=\indexdummyfont
  1270. \let\samp=\indexdummyfont
  1271. \let\kbd=\indexdummyfont
  1272. \let\key=\indexdummyfont
  1273. \let\var=\indexdummyfont
  1274. \let\TeX=\indexdummytex
  1275. \let\dots=\indexdummydots
  1276. }
  1277.  
  1278. % To define \realbackslash, we must make \ not be an escape.
  1279. % We must first make another character (@) an escape
  1280. % so we do not become unable to do a definition.
  1281.  
  1282. {\catcode`\@=0 \catcode`\\=\other
  1283. @gdef@realbackslash{\}}
  1284.  
  1285. \let\indexbackslash=0  %overridden during \printindex.
  1286.  
  1287. \def\doind #1#2{%
  1288. {\count10=\lastpenalty %
  1289. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1290. \escapechar=`\\%
  1291. {\let\folio=0% Expand all macros now EXCEPT \folio
  1292. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1293. % so it will be output as is; and it will print as backslash in the indx.
  1294. %
  1295. % Now process the index-string once, with all font commands turned off,
  1296. % to get the string to sort the index by.
  1297. {\indexnofonts
  1298. \xdef\temp1{#2}%
  1299. }%
  1300. % Now produce the complete index entry.  We process the index-string again,
  1301. % this time with font commands expanded, to get what to print in the index.
  1302. \edef\temp{%
  1303. \write \csname#1indfile\endcsname{%
  1304. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1305. \temp }%
  1306. }\penalty\count10}}
  1307.  
  1308. \def\dosubind #1#2#3{%
  1309. {\count10=\lastpenalty %
  1310. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1311. \escapechar=`\\%
  1312. {\let\folio=0%
  1313. \def\rawbackslashxx{\indexbackslash}%
  1314. %
  1315. % Now process the index-string once, with all font commands turned off,
  1316. % to get the string to sort the index by.
  1317. {\indexnofonts
  1318. \xdef\temp1{#2 #3}%
  1319. }%
  1320. % Now produce the complete index entry.  We process the index-string again,
  1321. % this time with font commands expanded, to get what to print in the index.
  1322. \edef\temp{%
  1323. \write \csname#1indfile\endcsname{%
  1324. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1325. \temp }%
  1326. }\penalty\count10}}
  1327.  
  1328. % The index entry written in the file actually looks like
  1329. %  \entry {sortstring}{page}{topic}
  1330. % or
  1331. %  \entry {sortstring}{page}{topic}{subtopic}
  1332. % The texindex program reads in these files and writes files
  1333. % containing these kinds of lines:
  1334. %  \initial {c}
  1335. %     before the first topic whose initial is c
  1336. %  \entry {topic}{pagelist}
  1337. %     for a topic that is used without subtopics
  1338. %  \primary {topic}
  1339. %     for the beginning of a topic that is used with subtopics
  1340. %  \secondary {subtopic}{pagelist}
  1341. %     for each subtopic.
  1342.  
  1343. % Define the user-accessible indexing commands 
  1344. % @findex, @vindex, @kindex, @cindex.
  1345.  
  1346. \def\findex {\fnindex}
  1347. \def\kindex {\kyindex}
  1348. \def\cindex {\cpindex}
  1349. \def\vindex {\vrindex}
  1350. \def\tindex {\tpindex}
  1351. \def\pindex {\pgindex}
  1352.  
  1353. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1354. {\obeylines %
  1355. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1356. \dosubind{cp}{#2}{#1}}}
  1357.  
  1358. % Define the macros used in formatting output of the sorted index material.
  1359.  
  1360. % This is what you call to cause a particular index to get printed.
  1361. % Write
  1362. % @unnumbered Function Index
  1363. % @printindex fn
  1364.  
  1365. \def\printindex{\parsearg\doprintindex}
  1366.  
  1367. \def\doprintindex#1{%
  1368.   \tex
  1369.   \dobreak \chapheadingskip {10000}
  1370.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1371.   \catcode`\$=\other\catcode`\_=\other
  1372.   \catcode`\~=\other
  1373.   %
  1374.   % The following don't help, since the chars were translated
  1375.   % when the raw index was written, and their fonts were discarded
  1376.   % due to \indexnofonts.
  1377.   %\catcode`\"=\active
  1378.   %\catcode`\^=\active
  1379.   %\catcode`\_=\active
  1380.   %\catcode`\|=\active
  1381.   %\catcode`\<=\active
  1382.   %\catcode`\>=\active
  1383.   % %
  1384.   \def\indexbackslash{\rawbackslashxx}
  1385.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1386.   \begindoublecolumns
  1387.   %
  1388.   % See if the index file exists and is nonempty.
  1389.   \openin 1 \jobname.#1s
  1390.   \ifeof 1 
  1391.     % \enddoublecolumns gets confused if there is no text in the index,
  1392.     % and it loses the chapter title and the aux file entries for the
  1393.     % index.  The easiest way to prevent this problem is to make sure
  1394.     % there is some text.
  1395.     (Index is nonexistent)
  1396.     \else
  1397.     %
  1398.     % If the index file exists but is empty, then \openin leaves \ifeof
  1399.     % false.  We have to make TeX try to read something from the file, so
  1400.     % it can discover if there is anything in it.
  1401.     \read 1 to \temp
  1402.     \ifeof 1
  1403.       (Index is empty)
  1404.     \else
  1405.       \input \jobname.#1s
  1406.     \fi
  1407.   \fi
  1408.   \closein 1
  1409.   \enddoublecolumns
  1410.   \Etex
  1411. }
  1412.  
  1413. % These macros are used by the sorted index file itself.
  1414. % Change them to control the appearance of the index.
  1415.  
  1416. % Same as \bigskipamount except no shrink.
  1417. % \balancecolumns gets confused if there is any shrink.
  1418. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1419.  
  1420. \def\initial #1{%
  1421. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1422. \ifdim\lastskip<\initialskipamount
  1423. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1424. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1425.  
  1426. \def\entry #1#2{
  1427. {\parfillskip=0in \parskip=0in \parindent=0in
  1428. \hangindent=1in \hangafter=1%
  1429. \noindent\hbox{#1}\indexdotfill #2\par
  1430. }}
  1431.  
  1432. % Like \dotfill except takes at least 1 em.
  1433. \def\indexdotfill{\cleaders
  1434.   \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
  1435.  
  1436. \def\primary #1{\line{#1\hfil}}
  1437.  
  1438. \newskip\secondaryindent \secondaryindent=0.5cm
  1439.  
  1440. \def\secondary #1#2{
  1441. {\parfillskip=0in \parskip=0in
  1442. \hangindent =1in \hangafter=1
  1443. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1444. }}
  1445.  
  1446. %% Define two-column mode, which is used in indexes.
  1447. %% Adapted from the TeXBook, page 416
  1448. \catcode `\@=11
  1449.  
  1450. \newbox\partialpage
  1451.  
  1452. \newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
  1453. \newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
  1454. \newdimen\availdimen@
  1455.  
  1456. \def\begindoublecolumns{\begingroup
  1457.   \output={\global\setbox\partialpage=
  1458.     \vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
  1459.   \output={\doublecolumnout}%
  1460.   \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
  1461. \def\enddoublecolumns{\output={\balancecolumns}\eject
  1462.   \endgroup \pagegoal=\vsize}
  1463.  
  1464. \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1465.   \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1466.   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1467.   \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
  1468. \def\pagesofar{\unvbox\partialpage %
  1469.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1470. %          changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
  1471.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1472. \def\balancecolumns{%
  1473. % Unset the glue.
  1474.   \setbox255=\vbox{\unvbox255}
  1475.   \dimen@=\ht255
  1476.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1477.   \divide\dimen@ by2
  1478.   \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpage
  1479. % If the remaining data is too big for one page,
  1480. % output one page normally, then work with what remains.
  1481.   \ifdim \dimen@>\availdimen@
  1482.    {
  1483.      \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1484.      \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1485.      \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1486.      \onepageout\pagesofar
  1487.    }
  1488. % Recompute size of what remains, in case we just output some of it.
  1489.   \dimen@=\ht255
  1490.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1491.   \divide\dimen@ by2
  1492.   \fi
  1493.   \setbox0=\vbox{\unvbox255}
  1494.   \splittopskip=\topskip
  1495.   {\vbadness=10000 \loop \global\setbox3=\copy0
  1496.     \global\setbox1=\vsplit3 to\dimen@
  1497.     \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  1498.   \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
  1499.   \pagesofar}
  1500.  
  1501. \catcode `\@=\other
  1502. \message{sectioning,}
  1503. % Define chapters, sections, etc.
  1504.  
  1505. \newcount \chapno
  1506. \newcount \secno        \secno=0
  1507. \newcount \subsecno     \subsecno=0
  1508. \newcount \subsubsecno  \subsubsecno=0
  1509.  
  1510. % This counter is funny since it counts through charcodes of letters A, B, ...
  1511. \newcount \appendixno  \appendixno = `\@
  1512. \def\appendixletter{\char\the\appendixno}
  1513.  
  1514. \newwrite \contentsfile
  1515. % This is called from \setfilename.
  1516. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1517.  
  1518. % Each @chapter defines this as the name of the chapter.
  1519. % page headings and footings can use it.  @section does likewise
  1520.  
  1521. \def\thischapter{} \def\thissection{}
  1522. \def\seccheck#1{\if \pageno<0 %
  1523. \errmessage{@#1 not allowed after generating table of contents}\fi
  1524. %
  1525. }
  1526.  
  1527. \def\chapternofonts{%
  1528. \let\rawbackslash=\relax%
  1529. \let\frenchspacing=\relax%
  1530. \def\TeX{\realbackslash TeX}
  1531. \def\dots{\realbackslash dots}
  1532. \def\copyright{\realbackslash copyright}
  1533. \def\tt{\realbackslash tt}
  1534. \def\bf{\realbackslash bf }
  1535. \def\w{\realbackslash w}
  1536. \def\less{\realbackslash less}
  1537. \def\gtr{\realbackslash gtr}
  1538. \def\hat{\realbackslash hat}
  1539. \def\char{\realbackslash char}
  1540. \def\tclose##1{\realbackslash tclose {##1}}
  1541. \def\code##1{\realbackslash code {##1}}
  1542. \def\samp##1{\realbackslash samp {##1}}
  1543. \def\r##1{\realbackslash r {##1}}
  1544. \def\b##1{\realbackslash b {##1}}
  1545. \def\key##1{\realbackslash key {##1}}
  1546. \def\file##1{\realbackslash file {##1}}
  1547. \def\kbd##1{\realbackslash kbd {##1}}
  1548. % These are redefined because @smartitalic wouldn't work inside xdef.
  1549. \def\i##1{\realbackslash i {##1}}
  1550. \def\cite##1{\realbackslash cite {##1}}
  1551. \def\var##1{\realbackslash var {##1}}
  1552. \def\emph##1{\realbackslash emph {##1}}
  1553. \def\dfn##1{\realbackslash dfn {##1}}
  1554. }
  1555.  
  1556. \def\thischaptername{No Chapter Title}
  1557. \outer\def\chapter{\parsearg\chapterzzz}
  1558. \def\chapterzzz #1{\seccheck{chapter}%
  1559. \secno=0 \subsecno=0 \subsubsecno=0
  1560. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1561. \chapmacro {#1}{\the\chapno}%
  1562. \gdef\thissection{#1}%
  1563. \gdef\thischaptername{#1}%
  1564. % We don't substitute the actual chapter name into \thischapter
  1565. % because we don't want its macros evaluated now.
  1566. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1567. {\chapternofonts%
  1568. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1569. \escapechar=`\\%
  1570. \write \contentsfile \temp  %
  1571. \donoderef %
  1572. \global\let\section = \numberedsec
  1573. \global\let\subsection = \numberedsubsec
  1574. \global\let\subsubsection = \numberedsubsubsec
  1575. }}
  1576.  
  1577. \outer\def\appendix{\parsearg\appendixzzz}
  1578. \def\appendixzzz #1{\seccheck{appendix}%
  1579. \secno=0 \subsecno=0 \subsubsecno=0
  1580. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1581. \chapmacro {#1}{Appendix \appendixletter}%
  1582. \gdef\thissection{#1}%
  1583. \gdef\thischaptername{#1}%
  1584. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1585. {\chapternofonts%
  1586. \edef\temp{{\realbackslash chapentry 
  1587.   {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1588. \escapechar=`\\%
  1589. \write \contentsfile \temp  %
  1590. \appendixnoderef %
  1591. \global\let\section = \appendixsec
  1592. \global\let\subsection = \appendixsubsec
  1593. \global\let\subsubsection = \appendixsubsubsec
  1594. }}
  1595.  
  1596. \outer\def\top{\parsearg\unnumberedzzz}
  1597. \outer\def\unnumbered{\parsearg\unnumberedzzz}
  1598. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1599. \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
  1600. \unnumbchapmacro {#1}%
  1601. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1602. {\chapternofonts%
  1603. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1604. \escapechar=`\\%
  1605. \write \contentsfile \temp  %
  1606. \unnumbnoderef %
  1607. \global\let\section = \unnumberedsec
  1608. \global\let\subsection = \unnumberedsubsec
  1609. \global\let\subsubsection = \unnumberedsubsubsec
  1610. }}
  1611.  
  1612. \outer\def\numberedsec{\parsearg\seczzz}
  1613. \def\seczzz #1{\seccheck{section}%
  1614. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1615. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1616. {\chapternofonts%
  1617. \edef\temp{{\realbackslash secentry %
  1618. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1619. \escapechar=`\\%
  1620. \write \contentsfile \temp %
  1621. \donoderef %
  1622. \penalty 10000 %
  1623. }}
  1624.  
  1625. \outer\def\appendixsection{\parsearg\appendixsectionzzz}
  1626. \outer\def\appendixsec{\parsearg\appendixsectionzzz}
  1627. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1628. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1629. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1630. {\chapternofonts%
  1631. \edef\temp{{\realbackslash secentry %
  1632. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1633. \escapechar=`\\%
  1634. \write \contentsfile \temp %
  1635. \appendixnoderef %
  1636. \penalty 10000 %
  1637. }}
  1638.  
  1639. \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
  1640. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1641. \plainsecheading {#1}\gdef\thissection{#1}%
  1642. {\chapternofonts%
  1643. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1644. \escapechar=`\\%
  1645. \write \contentsfile \temp %
  1646. \unnumbnoderef %
  1647. \penalty 10000 %
  1648. }}
  1649.  
  1650. \outer\def\numberedsubsec{\parsearg\numberedsubseczzz}
  1651. \def\numberedsubseczzz #1{\seccheck{subsection}%
  1652. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1653. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1654. {\chapternofonts%
  1655. \edef\temp{{\realbackslash subsecentry %
  1656. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1657. \escapechar=`\\%
  1658. \write \contentsfile \temp %
  1659. \donoderef %
  1660. \penalty 10000 %
  1661. }}
  1662.  
  1663. \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
  1664. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1665. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1666. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1667. {\chapternofonts%
  1668. \edef\temp{{\realbackslash subsecentry %
  1669. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1670. \escapechar=`\\%
  1671. \write \contentsfile \temp %
  1672. \appendixnoderef %
  1673. \penalty 10000 %
  1674. }}
  1675.  
  1676. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1677. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1678. \plainsecheading {#1}\gdef\thissection{#1}%
  1679. {\chapternofonts%
  1680. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1681. \escapechar=`\\%
  1682. \write \contentsfile \temp %
  1683. \unnumbnoderef %
  1684. \penalty 10000 %
  1685. }}
  1686.  
  1687. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubseczzz}
  1688. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  1689. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1690. \subsubsecheading {#1}
  1691.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1692. {\chapternofonts%
  1693. \edef\temp{{\realbackslash subsubsecentry %
  1694.   {#1}
  1695.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  1696.   {\noexpand\folio}}}%
  1697. \escapechar=`\\%
  1698. \write \contentsfile \temp %
  1699. \donoderef %
  1700. \penalty 10000 %
  1701. }}
  1702.  
  1703. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1704. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1705. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1706. \subsubsecheading {#1}
  1707.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1708. {\chapternofonts%
  1709. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1710.   {\appendixletter}
  1711.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  1712. \escapechar=`\\%
  1713. \write \contentsfile \temp %
  1714. \appendixnoderef %
  1715. \penalty 10000 %
  1716. }}
  1717.  
  1718. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1719. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1720. \plainsecheading {#1}\gdef\thissection{#1}%
  1721. {\chapternofonts%
  1722. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1723. \escapechar=`\\%
  1724. \write \contentsfile \temp %
  1725. \unnumbnoderef %
  1726. \penalty 10000 %
  1727. }}
  1728.  
  1729. % These are variants which are not "outer", so they can appear in @ifinfo.
  1730. % Actually, they should now be obsolete; ordinary section commands should work.
  1731. \def\infotop{\parsearg\unnumberedzzz}
  1732. \def\infounnumbered{\parsearg\unnumberedzzz}
  1733. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1734. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1735. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1736.  
  1737. \def\infoappendix{\parsearg\appendixzzz}
  1738. \def\infoappendixsec{\parsearg\appendixseczzz}
  1739. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1740. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1741.  
  1742. \def\infochapter{\parsearg\chapterzzz}
  1743. \def\infosection{\parsearg\sectionzzz}
  1744. \def\infosubsection{\parsearg\subsectionzzz}
  1745. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1746.  
  1747. % These macros control what the section commands do, according
  1748. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  1749. % Define them by default for a numbered chapter.
  1750. \global\let\section = \numberedsec
  1751. \global\let\subsection = \numberedsubsec
  1752. \global\let\subsubsection = \numberedsubsubsec
  1753.  
  1754. % Define @majorheading, @heading and @subheading
  1755.  
  1756. % NOTE on use of \vbox for chapter headings, section headings, and
  1757. % such:
  1758. %    1) We use \vbox rather than the earlier \line to permit
  1759. %       overlong headings to fold.
  1760. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  1761. %       heading is obnoxious; this forbids it.
  1762. %       3) Likewise, headings look best if no \parindent is used, and
  1763. %          if justification is not attempted.  Hence \raggedright.
  1764.  
  1765.  
  1766. \def\majorheading{\parsearg\majorheadingzzz}
  1767. \def\majorheadingzzz #1{%
  1768. {\advance\chapheadingskip by 10pt \chapbreak }%
  1769. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1770.                   \parindent=0pt\raggedright
  1771.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1772.  
  1773. \def\chapheading{\parsearg\chapheadingzzz}
  1774. \def\chapheadingzzz #1{\chapbreak %
  1775. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1776.                   \parindent=0pt\raggedright
  1777.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1778.  
  1779. \def\heading{\parsearg\secheadingi}
  1780.  
  1781. \def\subheading{\parsearg\subsecheadingi}
  1782.  
  1783. \def\subsubheading{\parsearg\subsubsecheadingi}
  1784.  
  1785. % These macros generate a chapter, section, etc. heading only
  1786. % (including whitespace, linebreaking, etc. around it),
  1787. % given all the information in convenient, parsed form.
  1788.  
  1789. %%% Args are the skip and penalty (usually negative)
  1790. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1791.  
  1792. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1793.  
  1794. %%% Define plain chapter starts, and page on/off switching for it
  1795. % Parameter controlling skip before chapter headings (if needed)
  1796.  
  1797. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1798.  
  1799. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1800. \def\chappager{\par\vfill\supereject}
  1801. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1802.  
  1803. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1804.  
  1805. \def\CHAPPAGoff{
  1806. \global\let\pchapsepmacro=\chapbreak
  1807. \global\let\pagealignmacro=\chappager}
  1808.  
  1809. \def\CHAPPAGon{
  1810. \global\let\pchapsepmacro=\chappager
  1811. \global\let\pagealignmacro=\chappager
  1812. \global\def\HEADINGSon{\HEADINGSsingle}}
  1813.  
  1814. \def\CHAPPAGodd{
  1815. \global\let\pchapsepmacro=\chapoddpage
  1816. \global\let\pagealignmacro=\chapoddpage
  1817. \global\def\HEADINGSon{\HEADINGSdouble}}
  1818.  
  1819. \CHAPPAGon
  1820.  
  1821. \def\CHAPFplain{
  1822. \global\let\chapmacro=\chfplain
  1823. \global\let\unnumbchapmacro=\unnchfplain}
  1824.  
  1825. \def\chfplain #1#2{%
  1826.   \pchapsepmacro
  1827.   {%
  1828.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1829.                      \parindent=0pt\raggedright
  1830.                      \rm #2\enspace #1}%
  1831.   }%
  1832.   \bigskip
  1833.   \penalty5000
  1834. }
  1835.  
  1836. \def\unnchfplain #1{%
  1837. \pchapsepmacro %
  1838. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1839.                   \parindent=0pt\raggedright
  1840.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1841. }
  1842. \CHAPFplain % The default
  1843.  
  1844. \def\unnchfopen #1{%
  1845. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1846.                        \parindent=0pt\raggedright
  1847.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1848. }
  1849.  
  1850. \def\chfopen #1#2{\chapoddpage {\chapfonts
  1851. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1852. \par\penalty 5000 %
  1853. }
  1854.  
  1855. \def\CHAPFopen{
  1856. \global\let\chapmacro=\chfopen
  1857. \global\let\unnumbchapmacro=\unnchfopen}
  1858.  
  1859. % Parameter controlling skip before section headings.
  1860.  
  1861. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1862. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1863.  
  1864. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1865. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1866.  
  1867. % @paragraphindent  is defined for the Info formatting commands only.
  1868. \let\paragraphindent=\comment
  1869.  
  1870. % Section fonts are the base font at magstep2, which produces
  1871. % a size a bit more than 14 points in the default situation.    
  1872.  
  1873. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  1874. \def\plainsecheading #1{\secheadingi {#1}}
  1875. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  1876. \secheadingbreak}%
  1877. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1878.                  \parindent=0pt\raggedright
  1879.                  \rm #1\hfill}}%
  1880. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1881.  
  1882.  
  1883. % Subsection fonts are the base font at magstep1, 
  1884. % which produces a size of 12 points.
  1885.  
  1886. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  1887. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1888. \subsecheadingbreak}%
  1889. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1890.                      \parindent=0pt\raggedright
  1891.                      \rm #1\hfill}}%
  1892. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1893.  
  1894. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  1895.                   % Perhaps make sssec fonts scaled
  1896.                   % magstep half
  1897. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  1898. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1899. \subsecheadingbreak}%
  1900. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1901.                        \parindent=0pt\raggedright
  1902.                        \rm #1\hfill}}%
  1903. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  1904.  
  1905.  
  1906. \message{toc printing,}
  1907.  
  1908. % Finish up the main text and prepare to read what we've written
  1909. % to \contentsfile.
  1910.  
  1911. \newskip\contentsrightmargin \contentsrightmargin=1in
  1912. \def\startcontents#1{%
  1913.    \ifnum \pageno>0
  1914.       \pagealignmacro
  1915.       \immediate\closeout \contentsfile
  1916.       \pageno = -1        % Request roman numbered pages.
  1917.    \fi
  1918.    % Don't need to put `Contents' or `Short Contents' in the headline. 
  1919.    % It is abundantly clear what they are.
  1920.    \unnumbchapmacro{#1}\def\thischapter{}%
  1921.    \begingroup           % Set up to handle contents files properly.
  1922.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  1923.       \raggedbottom             % Worry more about breakpoints than the bottom.
  1924.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  1925. }
  1926.  
  1927.   
  1928. % Normal (long) toc.
  1929. \outer\def\contents{%
  1930.    \startcontents{Table of Contents}%
  1931.       \input \jobname.toc
  1932.    \endgroup
  1933.    \vfill \eject
  1934. }
  1935.  
  1936. % And just the chapters.
  1937. \outer\def\summarycontents{%
  1938.    \startcontents{Short Contents}%
  1939.       %
  1940.       \let\chapentry = \shortchapentry
  1941.       \let\unnumbchapentry = \shortunnumberedentry
  1942.       % We want a true roman here for the page numbers.
  1943.       \secfonts
  1944.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  1945.       \rm
  1946.       \advance\baselineskip by 1pt % Open it up a little.
  1947.       \def\secentry ##1##2##3##4{}
  1948.       \def\unnumbsecentry ##1##2{}
  1949.       \def\subsecentry ##1##2##3##4##5{}
  1950.       \def\unnumbsubsecentry ##1##2{}
  1951.       \def\subsubsecentry ##1##2##3##4##5##6{}
  1952.       \def\unnumbsubsubsecentry ##1##2{}
  1953.       \input \jobname.toc
  1954.    \endgroup
  1955.    \vfill \eject
  1956. }
  1957. \let\shortcontents = \summarycontents
  1958.  
  1959. % These macros generate individual entries in the table of contents.
  1960. % The first argument is the chapter or section name.
  1961. % The last argument is the page number.
  1962. % The arguments in between are the chapter number, section number, ...
  1963.  
  1964. % Chapter-level things, for both the long and short contents.
  1965. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  1966.  
  1967. % See comments in \dochapentry re vbox and related settings
  1968. \def\shortchapentry#1#2#3{%
  1969.    \vbox{\hyphenpenalty=10000\tolerance=5000
  1970.     \parindent=0pt\strut\raggedright
  1971.     {#2\labelspace #1}\dotfill\doshortpageno{#3}}%
  1972. }
  1973.  
  1974. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  1975. \def\shortunnumberedentry#1#2{%
  1976.    \vbox{\hyphenpenalty=10000\tolerance=5000
  1977.     \parindent=0pt\strut\raggedright
  1978.     #1\dotfill\doshortpageno{#2}}%
  1979. }
  1980.  
  1981. % Sections.
  1982. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  1983. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  1984.  
  1985. % Subsections.
  1986. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  1987. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  1988.  
  1989. % And subsubsections.
  1990. \def\subsubsecentry#1#2#3#4#5#6{%
  1991.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  1992. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  1993.  
  1994.  
  1995. % This parameter controls the indentation of the various levels.
  1996. \newdimen\tocindent \tocindent = 3pc
  1997.  
  1998. % Now for the actual typesetting. In all these, #1 is the text and #2 is the 
  1999. % page number.
  2000. %
  2001. % If the toc has to be broken over pages, we would want to be at chapters 
  2002. % if at all possible; hence the \penalty.
  2003. \def\dochapentry#1#2{%
  2004.    \penalty-300 \vskip\baselineskip
  2005.    % This \vbox (and similar ones in dosecentry etc.) used to be a
  2006.    % \line; changed to permit linebreaks for long headings.  See
  2007.    % comments above \majorheading.  Here we also use \strut to
  2008.    % keep the top end of the vbox from jamming up against the previous
  2009.    % entry in the table of contents.
  2010.    \vbox{\chapentryfonts
  2011.      \hyphenpenalty=10000\tolerance=5000 % this line and next introduced
  2012.      \parindent=0pt\strut\raggedright    % with \line -> \vbox change
  2013.      #1\dotfill
  2014.      \dopageno{#2}}%
  2015.    \nobreak\vskip .25\baselineskip
  2016. }
  2017.  
  2018. \def\dosecentry#1#2{%
  2019.    \vbox{\secentryfonts \leftskip=\tocindent
  2020.     \hyphenpenalty=10000\tolerance=5000
  2021.     \parindent=0pt\strut\raggedright #1\dotfill
  2022.     \dopageno{#2}}%
  2023. }
  2024.  
  2025. \def\dosubsecentry#1#2{%
  2026.    \vbox{\subsecentryfonts \leftskip=2\tocindent
  2027.     \hyphenpenalty=10000\tolerance=5000
  2028.     \parindent=0pt\strut\raggedright #1\dotfill
  2029.     \dopageno{#2}}%
  2030. }
  2031.  
  2032. \def\dosubsubsecentry#1#2{%
  2033.    \vbox{\subsubsecentryfonts \leftskip=3\tocindent
  2034.     \hyphenpenalty=10000\tolerance=5000
  2035.     \parindent=0pt\strut\raggedright #1\dotfill
  2036.     \dopageno{#2}}%
  2037. }
  2038.  
  2039. % Space between chapter (or whatever) number and the title.
  2040. \def\labelspace{\hskip1em \relax}
  2041.  
  2042. \def\dopageno#1{{\rm #1}}
  2043. \def\doshortpageno#1{{\rm #1}}
  2044.  
  2045. \def\chapentryfonts{\secfonts \rm}
  2046. \def\secentryfonts{\textfonts}
  2047. \let\subsecentryfonts = \textfonts
  2048. \let\subsubsecentryfonts = \textfonts
  2049.  
  2050.  
  2051. \message{environments,}
  2052.  
  2053. % Since these characters are used in examples, it should be an even number of 
  2054. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2055. % Furthermore, these definitions must come after we define our fonts.
  2056. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2057. \newbox\pushcharbox    \newbox\bullbox
  2058. \newbox\equivbox       \newbox\errorbox
  2059.  
  2060. \let\ptexequiv = \equiv
  2061.  
  2062. {\tentt
  2063. \global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2064. \global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2065. \global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2066. \global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2067. % Adapted from the manmac format (p.420 of TeXbook)
  2068. \global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2069.                                       depth .1ex\hfil}
  2070. }
  2071.  
  2072. \def\point{$\star$}
  2073.  
  2074. \def\result{\leavevmode\raise.15ex\copy\dblarrowbox}
  2075. \def\expansion{\leavevmode\raise.1ex\copy\longdblarrowbox}
  2076. \def\print{\leavevmode\lower.1ex\copy\pushcharbox}
  2077.  
  2078. \def\equiv{\leavevmode\lower.1ex\copy\equivbox}
  2079.  
  2080. % Does anyone really want this?
  2081. % \def\bull{\leavevmode\copy\bullbox}
  2082.  
  2083. % Adapted from the TeXbook's \boxit.
  2084. {\tentt \global\dimen0 = 3em}% Width of the box.
  2085. \dimen2 = .55pt % Thickness of rules
  2086. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2087. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2088.  
  2089. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2090.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2091.    \advance\hsize by -2\dimen2 % Rules.
  2092.    \vbox{
  2093.       \hrule height\dimen2
  2094.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2095.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2096.          \kern3pt\vrule width\dimen2}% Space to right.
  2097.       \hrule height\dimen2}
  2098.     \hfil}
  2099.  
  2100. % The @error{} command.
  2101. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2102.  
  2103. % @tex ... @end tex    escapes into raw Tex temporarily.
  2104. % One exception: @ is still an escape character, so that @end tex works.
  2105. % But \@ or @@ will get a plain tex @ character.
  2106.  
  2107. \def\tex{\begingroup
  2108. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2109. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  2110. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  2111. \catcode `\%=14
  2112. \catcode 43=12
  2113. \catcode`\"=12
  2114. \catcode`\==12
  2115. \catcode`\|=12
  2116. \catcode`\<=12
  2117. \catcode`\>=12
  2118. \escapechar=`\\
  2119. %
  2120. \let\{=\ptexlbrace
  2121. \let\}=\ptexrbrace
  2122. \let\.=\ptexdot
  2123. \let\*=\ptexstar
  2124. \let\dots=\ptexdots
  2125. \def\@{@}%
  2126. \let\bullet=\ptexbullet
  2127. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  2128. \let\L=\ptexL
  2129. %
  2130. \let\Etex=\endgroup}
  2131.  
  2132. % Define @lisp ... @endlisp.
  2133. % @lisp does a \begingroup so it can rebind things,
  2134. % including the definition of @endlisp (which normally is erroneous).
  2135.  
  2136. % Amount to narrow the margins by for @lisp.
  2137. \newskip\lispnarrowing \lispnarrowing=0.4in
  2138.  
  2139. % This is the definition that ^M gets inside @lisp
  2140. % phr: changed space to \null, to avoid overfull hbox problems.
  2141. {\obeyspaces%
  2142. \gdef\lisppar{\null\endgraf}}
  2143.  
  2144. % Cause \obeyspaces to make each Space cause a word-separation
  2145. % rather than the default which is that it acts punctuation.
  2146. % This is because space in tt font looks funny.
  2147. {\obeyspaces %
  2148. \gdef\sepspaces{\def {\ }}}
  2149.  
  2150. \newskip\aboveenvskipamount \aboveenvskipamount= 0pt
  2151. \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
  2152. \endgraf \ifdim\lastskip<\aboveenvskipamount
  2153. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
  2154.  
  2155. \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
  2156. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
  2157.  
  2158. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  2159. \let\nonarrowing=\relax
  2160.  
  2161. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2162. % \cartouche: draw rectangle w/rounded corners around argument
  2163. \font\circle=lcircle10
  2164. \newdimen\circthick
  2165. \newdimen\cartouter\newdimen\cartinner
  2166. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  2167. \circthick=\fontdimen8\circle
  2168. %
  2169. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  2170. \def\ctr{{\hskip 6pt\circle\char'010}}
  2171. \def\cbl{{\circle\char'012\hskip -6pt}}
  2172. \def\cbr{{\hskip 6pt\circle\char'011}}
  2173. \def\carttop{\hbox to \cartouter{\hskip\lskip
  2174.     \ctl\leaders\hrule height\circthick\hfil\ctr
  2175.     \hskip\rskip}}
  2176. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  2177.     \cbl\leaders\hrule height\circthick\hfil\cbr
  2178.     \hskip\rskip}}
  2179. %
  2180. \newskip\lskip\newskip\rskip
  2181.  
  2182. \long\def\cartouche{%
  2183. \begingroup
  2184.     \lskip=\leftskip \rskip=\rightskip
  2185.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  2186.     \cartinner=\hsize \advance\cartinner by-\lskip 
  2187.                \advance\cartinner by-\rskip
  2188.     \cartouter=\hsize
  2189.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  2190. %                     side, and for 6pt waste from
  2191. %                     each corner char
  2192.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  2193.     % Flag to tell @lisp, etc., not to narrow margin.
  2194.     \let\nonarrowing=\comment
  2195.     \vbox\bgroup
  2196.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  2197.         \carttop
  2198.         \hbox\bgroup
  2199.             \hskip\lskip
  2200.             \vrule\kern3pt
  2201.             \vbox\bgroup
  2202.                 \hsize=\cartinner
  2203.                 \kern3pt
  2204.                 \begingroup
  2205.                     \baselineskip=\normbskip
  2206.                     \lineskip=\normlskip
  2207.                     \parskip=\normpskip
  2208.                     \vskip -\parskip
  2209. \def\Ecartouche{%
  2210.                 \endgroup
  2211.                 \kern3pt
  2212.             \egroup
  2213.             \kern3pt\vrule
  2214.             \hskip\rskip
  2215.         \egroup
  2216.         \cartbot
  2217.     \egroup
  2218. \endgroup
  2219. }}    
  2220.  
  2221. \def\lisp{\aboveenvbreak
  2222. \begingroup\inENV % This group ends at the end of the @lisp body
  2223. \hfuzz=12truept % Don't be fussy
  2224. % Make spaces be word-separators rather than space tokens.
  2225. \sepspaces %
  2226. % Single space lines
  2227. \singlespace %
  2228. % The following causes blank lines not to be ignored
  2229. % by adding a space to the end of each line.
  2230. \let\par=\lisppar
  2231. \def\Elisp{\endgroup\afterenvbreak}%
  2232. \parskip=0pt
  2233. % @cartouche defines \nonarrowing to inhibit narrowing
  2234. % at next level down.
  2235. \ifx\nonarrowing\relax
  2236. \advance \leftskip by \lispnarrowing
  2237. \let\nonarrowing=\relax
  2238. \fi
  2239. \parindent=0pt
  2240. \let\exdent=\internalexdent
  2241. \obeyspaces \obeylines \tt \rawbackslash
  2242. \def\next##1{}\next}
  2243.  
  2244.  
  2245. \let\example=\lisp
  2246. \def\Eexample{\Elisp}
  2247.  
  2248. \let\smallexample=\lisp
  2249. \def\Esmallexample{\Elisp}
  2250.  
  2251. % Macro for 9 pt. examples, necessary to print with 5" lines.
  2252. % From Pavel@xerox.  This is not really used unless the
  2253. % @smallbook command is given.
  2254.  
  2255. \def\smalllispx{\aboveenvbreak\begingroup\inENV
  2256. %            This group ends at the end of the @lisp body
  2257. \hfuzz=12truept % Don't be fussy
  2258. % Make spaces be word-separators rather than space tokens.
  2259. \sepspaces %
  2260. % Single space lines
  2261. \singlespace %
  2262. % The following causes blank lines not to be ignored
  2263. % by adding a space to the end of each line.
  2264. \let\par=\lisppar
  2265. \def\Esmalllisp{\endgroup\afterenvbreak}%
  2266. \parskip=0pt
  2267. % @cartouche defines \nonarrowing to inhibit narrowing
  2268. % at next level down.
  2269. \ifx\nonarrowing\relax
  2270. \advance \leftskip by \lispnarrowing
  2271. \let\nonarrowing=\relax
  2272. \fi
  2273. \parindent=0pt
  2274. \let\exdent=\internalexdent
  2275. \obeyspaces \obeylines \ninett \indexfonts \rawbackslash
  2276. \def\next##1{}\next}
  2277.  
  2278. % This is @display; same as @lisp except use roman font.
  2279.  
  2280. \def\display{\begingroup\inENV %This group ends at the end of the @display body
  2281. \aboveenvbreak
  2282. % Make spaces be word-separators rather than space tokens.
  2283. \sepspaces %
  2284. % Single space lines
  2285. \singlespace %
  2286. % The following causes blank lines not to be ignored
  2287. % by adding a space to the end of each line.
  2288. \let\par=\lisppar
  2289. \def\Edisplay{\endgroup\afterenvbreak}%
  2290. \parskip=0pt
  2291. % @cartouche defines \nonarrowing to inhibit narrowing
  2292. % at next level down.
  2293. \ifx\nonarrowing\relax
  2294. \advance \leftskip by \lispnarrowing
  2295. \let\nonarrowing=\relax
  2296. \fi
  2297. \parindent=0pt
  2298. \let\exdent=\internalexdent
  2299. \obeyspaces \obeylines
  2300. \def\next##1{}\next}
  2301.  
  2302. % This is @format; same as @lisp except use roman font and don't narrow margins
  2303.  
  2304. \def\format{\begingroup\inENV %This group ends at the end of the @format body
  2305. \aboveenvbreak
  2306. % Make spaces be word-separators rather than space tokens.
  2307. \sepspaces %
  2308. \singlespace %
  2309. % The following causes blank lines not to be ignored
  2310. % by adding a space to the end of each line.
  2311. \let\par=\lisppar
  2312. \def\Eformat{\endgroup\afterenvbreak}
  2313. \parskip=0pt \parindent=0pt
  2314. \obeyspaces \obeylines
  2315. \def\next##1{}\next}
  2316.  
  2317. % @flushleft and @flushright
  2318.  
  2319. \def\flushleft{%
  2320. \begingroup\inENV %This group ends at the end of the @format body
  2321. \aboveenvbreak
  2322. % Make spaces be word-separators rather than space tokens.
  2323. \sepspaces %
  2324. % The following causes blank lines not to be ignored
  2325. % by adding a space to the end of each line.
  2326. % This also causes @ to work when the directive name
  2327. % is terminated by end of line.
  2328. \let\par=\lisppar
  2329. \def\Eflushleft{\endgroup\afterenvbreak}%
  2330. \parskip=0pt \parindent=0pt
  2331. \obeyspaces \obeylines
  2332. \def\next##1{}\next}
  2333.  
  2334. \def\flushright{%
  2335. \begingroup\inENV %This group ends at the end of the @format body
  2336. \aboveenvbreak
  2337. % Make spaces be word-separators rather than space tokens.
  2338. \sepspaces %
  2339. % The following causes blank lines not to be ignored
  2340. % by adding a space to the end of each line.
  2341. % This also causes @ to work when the directive name
  2342. % is terminated by end of line.
  2343. \let\par=\lisppar
  2344. \def\Eflushright{\endgroup\afterenvbreak}%
  2345. \parskip=0pt \parindent=0pt
  2346. \advance \leftskip by 0pt plus 1fill
  2347. \obeyspaces \obeylines
  2348. \def\next##1{}\next}
  2349.  
  2350. % @quotation - narrow the margins.
  2351.  
  2352. \def\quotation{%
  2353. \begingroup\inENV %This group ends at the end of the @quotation body
  2354. {\parskip=0pt  % because we will skip by \parskip too, later
  2355. \aboveenvbreak}%
  2356. \singlespace
  2357. \parindent=0pt
  2358. \def\Equotation{\par\endgroup\afterenvbreak}%
  2359. % @cartouche defines \nonarrowing to inhibit narrowing
  2360. % at next level down.
  2361. \ifx\nonarrowing\relax
  2362. \advance \leftskip by \lispnarrowing
  2363. \advance \leftskip by \lispnarrowing
  2364. \let\nonarrowing=\relax
  2365. \fi}
  2366.  
  2367. \message{defuns,}
  2368. % Define formatter for defuns
  2369. % First, allow user to change definition object font (\df) internally
  2370. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2371.  
  2372. \newskip\defbodyindent \defbodyindent=.4in
  2373. \newskip\defargsindent \defargsindent=50pt
  2374. \newskip\deftypemargin \deftypemargin=12pt
  2375. \newskip\deflastargmargin \deflastargmargin=18pt
  2376.  
  2377. \newcount\parencount
  2378. % define \functionparens, which makes ( and ) and & do special things.
  2379. % \functionparens affects the group it is contained in.
  2380. \def\activeparens{%
  2381. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2382. \catcode`\[=\active \catcode`\]=\active}
  2383. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2384. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2385. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2386.  
  2387. % Definitions of (, ) and & used in args for functions.
  2388. % This is the definition of ( outside of all parentheses.
  2389. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2390. \global\advance\parencount by 1 }
  2391. %
  2392. % This is the definition of ( when already inside a level of parens.
  2393. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2394. %
  2395. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2396. % also in that case restore the outer-level definition of (.
  2397. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2398. \global\advance \parencount by -1 }
  2399. % If we encounter &foo, then turn on ()-hacking afterwards
  2400. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2401. %
  2402. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2403. } % End of definition inside \activeparens
  2404. %% These parens (in \boldbrax) actually are a little bolder than the
  2405. %% contained text.  This is especially needed for [ and ]
  2406. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2407. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2408.  
  2409. % First, defname, which formats the header line itself.
  2410. % #1 should be the function name.
  2411. % #2 should be the type of definition, such as "Function".
  2412.  
  2413. \def\defname #1#2{%
  2414. % Get the values of \leftskip and \rightskip as they were
  2415. % outside the @def...
  2416. \dimen2=\leftskip
  2417. \advance\dimen2 by -\defbodyindent
  2418. \dimen3=\rightskip
  2419. \advance\dimen3 by -\defbodyindent
  2420. \noindent        %
  2421. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2422. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2423. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2424. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2425. % Now output arg 2 ("Function" or some such)
  2426. % ending at \deftypemargin from the right margin,
  2427. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2428. {% Adjust \hsize to exclude the ambient margins,
  2429. % so that \rightline will obey them.
  2430. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2431. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2432. % Make all lines underfull and no complaints:
  2433. \tolerance=10000 \hbadness=10000    
  2434. \advance\leftskip by -\defbodyindent
  2435. {\df #1}\enskip        % Generate function name
  2436. }
  2437.  
  2438. % Actually process the body of a definition
  2439. % #1 should be the terminating control sequence, such as \Edefun.
  2440. % #2 should be the "another name" control sequence, such as \defunx.
  2441. % #3 should be the control sequence that actually processes the header,
  2442. %    such as \defunheader.
  2443.  
  2444. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2445. \medbreak %
  2446. % Define the end token that this defining construct specifies
  2447. % so that it will exit this group.
  2448. \def#1{\endgraf\endgroup\medbreak}%
  2449. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2450. \parindent=0in
  2451. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2452. \begingroup %
  2453. \catcode 61=\active %
  2454. \obeylines\activeparens\spacesplit#3}
  2455.  
  2456. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2457. \medbreak %
  2458. % Define the end token that this defining construct specifies
  2459. % so that it will exit this group.
  2460. \def#1{\endgraf\endgroup\medbreak}%
  2461. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2462. \parindent=0in
  2463. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2464. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2465.  
  2466. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2467. \medbreak %
  2468. % Define the end token that this defining construct specifies
  2469. % so that it will exit this group.
  2470. \def#1{\endgraf\endgroup\medbreak}%
  2471. \def#2##1 ##2 {\def#4{##1}%
  2472. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2473. \parindent=0in
  2474. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2475. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2476.  
  2477. % These parsing functions are similar to the preceding ones
  2478. % except that they do not make parens into active characters.
  2479. % These are used for "variables" since they have no arguments.
  2480.  
  2481. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2482. \medbreak %
  2483. % Define the end token that this defining construct specifies
  2484. % so that it will exit this group.
  2485. \def#1{\endgraf\endgroup\medbreak}%
  2486. \def#2{\begingroup\obeylines\spacesplit#3}%
  2487. \parindent=0in
  2488. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2489. \begingroup %
  2490. \catcode 61=\active %
  2491. \obeylines\spacesplit#3}
  2492.  
  2493. \def\defvrparsebody #1#2#3#4 {\begingroup\inENV %
  2494. \medbreak %
  2495. % Define the end token that this defining construct specifies
  2496. % so that it will exit this group.
  2497. \def#1{\endgraf\endgroup\medbreak}%
  2498. \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2499. \parindent=0in
  2500. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2501. \begingroup\obeylines\spacesplit{#3{#4}}}
  2502.  
  2503. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  2504. \medbreak %
  2505. % Define the end token that this defining construct specifies
  2506. % so that it will exit this group.
  2507. \def#1{\endgraf\endgroup\medbreak}%
  2508. \def#2##1 ##2 {\def#4{##1}%
  2509. \begingroup\obeylines\spacesplit{#3{##2}}}%
  2510. \parindent=0in
  2511. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2512. \begingroup\obeylines\spacesplit{#3{#5}}}
  2513.  
  2514. % Split up #2 at the first space token.
  2515. % call #1 with two arguments:
  2516. %  the first is all of #2 before the space token,
  2517. %  the second is all of #2 after that space token.
  2518. % If #2 contains no space token, all of it is passed as the first arg
  2519. % and the second is passed as empty.
  2520.  
  2521. {\obeylines
  2522. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2523. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2524. \ifx\relax #3%
  2525. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2526.  
  2527. % So much for the things common to all kinds of definitions.
  2528.  
  2529. % Define @defun.
  2530.  
  2531. % First, define the processing that is wanted for arguments of \defun
  2532. % Use this to expand the args and terminate the paragraph they make up
  2533.  
  2534. \def\defunargs #1{\functionparens \sl
  2535. % Expand, preventing hyphenation at `-' chars.
  2536. % Note that groups don't affect changes in \hyphenchar.
  2537. \hyphenchar\tensl=0
  2538. #1%
  2539. \hyphenchar\tensl=45
  2540. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2541. \interlinepenalty=10000
  2542. \advance\rightskip by 0pt plus 1fil
  2543. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2544. }
  2545.  
  2546. \def\deftypefunargs #1{%
  2547. % Expand, preventing hyphenation at `-' chars.
  2548. % Note that groups don't affect changes in \hyphenchar.
  2549. \functionparens
  2550. \code{#1}%
  2551. \interlinepenalty=10000
  2552. \advance\rightskip by 0pt plus 1fil
  2553. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2554. }
  2555.  
  2556. % Do complete processing of one @defun or @defunx line already parsed.
  2557.  
  2558. % @deffn Command forward-char nchars
  2559.  
  2560. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2561.  
  2562. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2563. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2564. \catcode 61=\other % Turn off change made in \defparsebody
  2565. }
  2566.  
  2567. % @defun == @deffn Function
  2568.  
  2569. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2570.  
  2571. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2572. \begingroup\defname {#1}{Function}%
  2573. \defunargs {#2}\endgroup %
  2574. \catcode 61=\other % Turn off change made in \defparsebody
  2575. }
  2576.  
  2577. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2578.  
  2579. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2580.  
  2581. % #1 is the data type.  #2 is the name and args.
  2582. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2583. % #1 is the data type, #2 the name, #3 the args.
  2584. \def\deftypefunheaderx #1#2 #3\relax{%
  2585. \doind {fn}{\code{#2}}% Make entry in function index
  2586. \begingroup\defname {\code{#1} #2}{Function}%
  2587. \deftypefunargs {#3}\endgroup %
  2588. \catcode 61=\other % Turn off change made in \defparsebody
  2589. }
  2590.  
  2591. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2592.  
  2593. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2594.  
  2595. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2596. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2597. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2598. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2599. \doind {fn}{\code{#3}}% Make entry in function index
  2600. \begingroup\defname {\code{#2} #3}{#1}%
  2601. \deftypefunargs {#4}\endgroup %
  2602. \catcode 61=\other % Turn off change made in \defparsebody
  2603. }
  2604.  
  2605. % @defmac == @deffn Macro
  2606.  
  2607. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2608.  
  2609. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2610. \begingroup\defname {#1}{Macro}%
  2611. \defunargs {#2}\endgroup %
  2612. \catcode 61=\other % Turn off change made in \defparsebody
  2613. }
  2614.  
  2615. % @defspec == @deffn Special Form
  2616.  
  2617. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2618.  
  2619. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2620. \begingroup\defname {#1}{Special Form}%
  2621. \defunargs {#2}\endgroup %
  2622. \catcode 61=\other % Turn off change made in \defparsebody
  2623. }
  2624.  
  2625. % This definition is run if you use @defunx
  2626. % anywhere other than immediately after a @defun or @defunx.
  2627.  
  2628. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2629. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2630. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2631. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2632. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2633. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2634.  
  2635. % @defmethod, and so on
  2636.  
  2637. % @defop {Funny Method} foo-class frobnicate argument
  2638.  
  2639. \def\defop #1 {\def\defoptype{#1}%
  2640. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2641.  
  2642. \def\defopheader #1#2#3{%
  2643. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2644. \begingroup\defname {#2}{\defoptype{} on #1}%
  2645. \defunargs {#3}\endgroup %
  2646. }
  2647.  
  2648. % @defmethod == @defop Method
  2649.  
  2650. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2651.  
  2652. \def\defmethodheader #1#2#3{%
  2653. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2654. \begingroup\defname {#2}{Method on #1}%
  2655. \defunargs {#3}\endgroup %
  2656. }
  2657.  
  2658. % @defcv {Class Option} foo-class foo-flag
  2659.  
  2660. \def\defcv #1 {\def\defcvtype{#1}%
  2661. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2662.  
  2663. \def\defcvarheader #1#2#3{%
  2664. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2665. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2666. \defvarargs {#3}\endgroup %
  2667. }
  2668.  
  2669. % @defivar == @defcv {Instance Variable}
  2670.  
  2671. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  2672.  
  2673. \def\defivarheader #1#2#3{%
  2674. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2675. \begingroup\defname {#2}{Instance Variable of #1}%
  2676. \defvarargs {#3}\endgroup %
  2677. }
  2678.  
  2679. % These definitions are run if you use @defmethodx, etc.,
  2680. % anywhere other than immediately after a @defmethod, etc.
  2681.  
  2682. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2683. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2684. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2685. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2686.  
  2687. % Now @defvar
  2688.  
  2689. % First, define the processing that is wanted for arguments of @defvar.
  2690. % This is actually simple: just print them in roman.
  2691. % This must expand the args and terminate the paragraph they make up
  2692. \def\defvarargs #1{\normalparens #1%
  2693. \interlinepenalty=10000
  2694. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2695.  
  2696. % @defvr Counter foo-count
  2697.  
  2698. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  2699.  
  2700. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2701. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2702.  
  2703. % @defvar == @defvr Variable
  2704.  
  2705. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  2706.  
  2707. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2708. \begingroup\defname {#1}{Variable}%
  2709. \defvarargs {#2}\endgroup %
  2710. }
  2711.  
  2712. % @defopt == @defvr {User Option}
  2713.  
  2714. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  2715.  
  2716. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2717. \begingroup\defname {#1}{User Option}%
  2718. \defvarargs {#2}\endgroup %
  2719. }
  2720.  
  2721. % @deftypevar int foobar
  2722.  
  2723. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2724.  
  2725. % #1 is the data type.  #2 is the name.
  2726. \def\deftypevarheader #1#2{%
  2727. \doind {vr}{\code{#2}}% Make entry in variables index
  2728. \begingroup\defname {\code{#1} #2}{Variable}%
  2729. \interlinepenalty=10000
  2730. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2731. \endgroup}
  2732.  
  2733. % @deftypevr {Global Flag} int enable
  2734.  
  2735. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2736.  
  2737. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2738. \begingroup\defname {\code{#2} #3}{#1}
  2739. \interlinepenalty=10000
  2740. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2741. \endgroup}
  2742.  
  2743. % This definition is run if you use @defvarx
  2744. % anywhere other than immediately after a @defvar or @defvarx.
  2745.  
  2746. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2747. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2748. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2749. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2750. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2751.  
  2752. % Now define @deftp
  2753. % Args are printed in bold, a slight difference from @defvar.
  2754.  
  2755. \def\deftpargs #1{\bf \defvarargs{#1}}
  2756.  
  2757. % @deftp Class window height width ...
  2758.  
  2759. \def\deftp{\defvrparsebody\Edeftp\deftpx\deftpheader}
  2760.  
  2761. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2762. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2763.  
  2764. % This definition is run if you use @deftpx, etc
  2765. % anywhere other than immediately after a @deftp, etc.
  2766.  
  2767. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2768.  
  2769. \message{cross reference,}
  2770. % Define cross-reference macros
  2771. \newwrite \auxfile
  2772.  
  2773. \newif\ifhavexrefs  % True if xref values are known.
  2774. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2775.  
  2776. % \setref{foo} defines a cross-reference point named foo.
  2777.  
  2778. \def\setref#1{%
  2779. %\dosetq{#1-title}{Ytitle}%
  2780. \dosetq{#1-pg}{Ypagenumber}%
  2781. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2782.  
  2783. \def\unnumbsetref#1{%
  2784. %\dosetq{#1-title}{Ytitle}%
  2785. \dosetq{#1-pg}{Ypagenumber}%
  2786. \dosetq{#1-snt}{Ynothing}}
  2787.  
  2788. \def\appendixsetref#1{%
  2789. %\dosetq{#1-title}{Ytitle}%
  2790. \dosetq{#1-pg}{Ypagenumber}%
  2791. \dosetq{#1-snt}{Yappendixletterandtype}}
  2792.  
  2793. % \xref, \pxref, and \ref generate cross-references to specified points.
  2794. % For \xrefX, #1 is the node name, #2 the name of the Info
  2795. % cross-reference, #3 the printed node name, #4 the name of the Info
  2796. % file, #5 the name of the printed manual.  All but the node name can be
  2797. % omitted.
  2798. \def\pxref#1{see \xrefX[#1,,,,,,,]}
  2799. \def\xref#1{See \xrefX[#1,,,,,,,]}
  2800. \def\ref#1{\xrefX[#1,,,,,,,]}
  2801. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2802. \def\printedmanual{\ignorespaces #5}%
  2803. \def\printednodename{\ignorespaces #3}%
  2804. %
  2805. \setbox1=\hbox{\printedmanual}%
  2806. \setbox0=\hbox{\printednodename}%
  2807. \ifdim \wd0=0pt%
  2808. \def\printednodename{\ignorespaces #1}%
  2809. %%% Uncommment the following line to make the actual chapter or section title
  2810. %%% appear inside the square brackets.
  2811. %\def\printednodename{#1-title}%
  2812. \fi%
  2813. %
  2814. %
  2815. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2816. % not insert empty discretionaries after hyphens, which means that it
  2817. % will not find a line break at a hyphen in a node names.  Since some
  2818. % manuals are best written with fairly long node names, containing
  2819. % hyphens, this is a loss.  Therefore, we simply give the text of
  2820. % the node name again, so it is as if TeX is seeing it for the first
  2821. % time.
  2822. \ifdim \wd1>0pt
  2823. section ``\printednodename'' in \cite{\printedmanual}%
  2824. \else%
  2825. \turnoffactive%
  2826. \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
  2827. \fi
  2828. \endgroup}
  2829.  
  2830. % \dosetq is the interface for calls from other macros
  2831.  
  2832. % Use \turnoffactive so that punctuation chars such as underscore
  2833. % work in node names.
  2834. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2835. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2836. \next}}
  2837.  
  2838. % \internalsetq {foo}{page} expands into
  2839. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2840. % When the aux file is read, ' is the escape character
  2841.  
  2842. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2843.  
  2844. % Things to be expanded by \internalsetq
  2845.  
  2846. \def\Ypagenumber{\folio}
  2847.  
  2848. \def\Ytitle{\thischapter}
  2849.  
  2850. \def\Ynothing{}
  2851.  
  2852. \def\Ysectionnumberandtype{%
  2853. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2854. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2855. \else \ifnum \subsubsecno=0 %
  2856. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2857. \else %
  2858. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2859. \fi \fi \fi }
  2860.  
  2861. \def\Yappendixletterandtype{%
  2862. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
  2863. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2864. \else \ifnum \subsubsecno=0 %
  2865. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2866. \else %
  2867. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2868. \fi \fi \fi }
  2869.  
  2870. \gdef\xreftie{'tie}
  2871.  
  2872. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2873. % messages, but if we're using an old version of TeX, don't do anything.
  2874. \ifx\inputlineno\thisisundefined
  2875.   \let\linenumber = \empty % Non-3.0.
  2876. \else
  2877.   \def\linenumber{\the\inputlineno:\space}
  2878. \fi
  2879.  
  2880. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2881. % If its value is nonempty, SUFFIX is output afterward.
  2882.  
  2883. \def\refx#1#2{%
  2884.   \expandafter\ifx\csname X#1\endcsname\relax
  2885.     % If not defined, say something at least.
  2886.     $\langle$un\-de\-fined$\rangle$%
  2887.     \ifhavexrefs
  2888.       \message{\linenumber Undefined cross reference `#1'.}%
  2889.     \else
  2890.       \ifwarnedxrefs\else
  2891.         \global\warnedxrefstrue
  2892.         \message{Cross reference values unknown; you must run TeX again.}%
  2893.       \fi
  2894.     \fi
  2895.   \else
  2896.     % It's defined, so just use it.
  2897.     \csname X#1\endcsname
  2898.   \fi
  2899.   #2% Output the suffix in any case.
  2900. }
  2901.  
  2902. % Read the last existing aux file, if any.  No error if none exists.
  2903.  
  2904. % This is the macro invoked by entries in the aux file.
  2905. \def\xrdef #1#2{
  2906. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2907.  
  2908. \def\readauxfile{%
  2909. \begingroup
  2910. \catcode `\^^@=\other
  2911. \catcode `\=\other
  2912. \catcode `\=\other
  2913. \catcode `\^^C=\other
  2914. \catcode `\^^D=\other
  2915. \catcode `\^^E=\other
  2916. \catcode `\^^F=\other
  2917. \catcode `\^^G=\other
  2918. \catcode `\^^H=\other
  2919. \catcode `\ =\other
  2920. \catcode `\^^L=\other
  2921. \catcode `\=\other
  2922. \catcode `\=\other
  2923. \catcode `\=\other
  2924. \catcode `\=\other
  2925. \catcode `\=\other
  2926. \catcode `\=\other
  2927. \catcode `\=\other
  2928. \catcode `\=\other
  2929. \catcode `\=\other
  2930. \catcode `\=\other
  2931. \catcode `\=\other
  2932. \catcode `\=\other
  2933. \catcode 26=\other
  2934. \catcode `\^^[=\other
  2935. \catcode `\^^\=\other
  2936. \catcode `\^^]=\other
  2937. \catcode `\^^^=\other
  2938. \catcode `\^^_=\other
  2939. \catcode `\@=\other
  2940. \catcode `\^=\other
  2941. \catcode `\~=\other
  2942. \catcode `\[=\other
  2943. \catcode `\]=\other
  2944. \catcode`\"=\other
  2945. \catcode`\_=\other
  2946. \catcode`\|=\other
  2947. \catcode`\<=\other
  2948. \catcode`\>=\other
  2949. \catcode `\$=\other
  2950. \catcode `\#=\other
  2951. \catcode `\&=\other
  2952. % the aux file uses ' as the escape.
  2953. % Turn off \ as an escape so we do not lose on
  2954. % entries which were dumped with control sequences in their names.
  2955. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2956. % Reference to such entries still does not work the way one would wish,
  2957. % but at least they do not bomb out when the aux file is read in.
  2958. \catcode `\{=1 \catcode `\}=2
  2959. \catcode `\%=\other
  2960. \catcode `\'=0
  2961. \catcode `\\=\other
  2962. \openin 1 \jobname.aux
  2963. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  2964. \fi
  2965. % Open the new aux file.  Tex will close it automatically at exit.
  2966. \openout \auxfile=\jobname.aux
  2967. \endgroup}
  2968.  
  2969.  
  2970. % Footnotes.
  2971.  
  2972. \newcount \footnoteno
  2973.  
  2974. \def\supereject{\par\penalty -20000\footnoteno =0 }
  2975.  
  2976. % @footnotestyle is meaningful for info output only..
  2977. \let\footnotestyle=\comment
  2978.  
  2979. \let\ptexfootnote=\footnote
  2980.  
  2981. {\catcode `\@=11
  2982. \long\gdef\footnote #1{\global\advance \footnoteno by \@ne
  2983. \unskip
  2984. \edef\thisfootno{$^{\the\footnoteno}$}%
  2985. \let\@sf\empty
  2986. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  2987. \thisfootno\@sf \footnotezzz{#1}}
  2988. % \parsearg\footnotezzz}
  2989.  
  2990. \long\gdef\footnotezzz #1{\insert\footins{
  2991. \interlinepenalty\interfootnotelinepenalty
  2992. \splittopskip\ht\strutbox % top baseline for broken footnotes
  2993. \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  2994. \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  2995. \footstrut\parindent=\defaultparindent\hang\textindent{\thisfootno}#1\strut}}
  2996.  
  2997. }%end \catcode `\@=11
  2998.  
  2999. % End of control word definitions.
  3000.  
  3001. \message{and turning on texinfo input format.}
  3002.  
  3003. \def\openindices{%
  3004.    \newindex{cp}%
  3005.    \newcodeindex{fn}%
  3006.    \newcodeindex{vr}%
  3007.    \newcodeindex{tp}%
  3008.    \newcodeindex{ky}%
  3009.    \newcodeindex{pg}%
  3010. }
  3011.  
  3012. % Set some numeric style parameters, for 8.5 x 11 format.
  3013.  
  3014. %\hsize = 6.5in
  3015. \newdimen\defaultparindent \defaultparindent = 15pt
  3016. \parindent = \defaultparindent
  3017. \parskip 18pt plus 1pt
  3018. \baselineskip 15pt
  3019. \advance\topskip by 1.2cm
  3020.  
  3021. % Prevent underfull vbox error messages.
  3022. \vbadness=10000
  3023.  
  3024. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  3025. % using an old version of TeX, don't do anything.  We want the amount of
  3026. % stretch added to depend on the line length, hence the dependence on
  3027. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  3028. \ifx\emergencystretch\thisisundefined \else
  3029.   \emergencystretch = \hsize
  3030.   \divide\emergencystretch by 45
  3031. \fi
  3032.  
  3033. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  3034. \def\smallbook{
  3035. \global\lispnarrowing = 0.3in
  3036. \global\baselineskip 12pt
  3037. \global\parskip 3pt plus 1pt
  3038. \global\hsize = 5in
  3039. \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
  3040. \global\vsize=7.5in
  3041. \global\tolerance=700
  3042. \global\hfuzz=1pt
  3043. \global\contentsrightmargin=0pt
  3044.  
  3045. \global\pagewidth=\hsize
  3046. \global\pageheight=\vsize
  3047.  
  3048. \global\let\smalllisp=\smalllispx
  3049. \global\let\smallexample=\smalllispx
  3050. \global\def\Esmallexample{\Esmalllisp}
  3051. }
  3052.  
  3053. % Use @afourpaper to print on European A4 paper.
  3054. \def\afourpaper{
  3055. \global\tolerance=700
  3056. \global\hfuzz=1pt
  3057. \global\baselineskip=12pt
  3058. \global\parskip 15pt plus 1pt
  3059.  
  3060. \global\vsize= 53\baselineskip
  3061. \advance\vsize by \topskip
  3062. %\global\hsize=   5.85in     % A4 wide 10pt
  3063. \global\hsize=  6.5in
  3064. \global\outerhsize=\hsize
  3065. \global\advance\outerhsize by 0.5in
  3066. \global\outervsize=\vsize
  3067. \global\advance\outervsize by 0.6in
  3068. \global\doublecolumnhsize=\hsize
  3069. \global\divide\doublecolumnhsize by 2
  3070. \global\advance\doublecolumnhsize by -0.1in
  3071. \global\doublecolumnvsize=\vsize
  3072. \global\multiply\doublecolumnvsize by 2
  3073. \global\advance\doublecolumnvsize by 0.1in
  3074.  
  3075. \global\pagewidth=\hsize
  3076. \global\pageheight=\vsize
  3077. }
  3078.  
  3079. %% For a final copy, take out the rectangles
  3080. %% that mark overfull boxes (in case you have decided
  3081. %% that the text looks ok even though it passes the margin).
  3082. \def\finalout{\overfullrule=0pt}
  3083.  
  3084. % Define macros to output various characters with catcode for normal text.
  3085. \catcode`\"=\other
  3086. \catcode`\~=\other
  3087. \catcode`\^=\other
  3088. \catcode`\_=\other
  3089. \catcode`\|=\other
  3090. \catcode`\<=\other
  3091. \catcode`\>=\other
  3092. \catcode`\+=\other
  3093. \def\normaldoublequote{"}
  3094. \def\normaltilde{~}
  3095. \def\normalcaret{^}
  3096. \def\normalunderscore{_}
  3097. \def\normalverticalbar{|}
  3098. \def\normalless{<}
  3099. \def\normalgreater{>}
  3100. \def\normalplus{+}
  3101.  
  3102. % This macro is used to make a character print one way in ttfont
  3103. % where it can probably just be output, and another way in other fonts,
  3104. % where something hairier probably needs to be done.
  3105. %
  3106. % #1 is what to print if we are indeed using \tt; #2 is what to print
  3107. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  3108. % interword stretch (and shrink), and it is reasonable to expect all
  3109. % typewriter fonts to have this, we can check that font parameter.
  3110. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  3111.  
  3112. % Turn off all special characters except @
  3113. % (and those which the user can use as if they were ordinary).
  3114. % Most of these we simply print from the \tt font, but for some, we can
  3115. % use math or other variants that look better in normal text.
  3116.  
  3117. \catcode`\"=\active
  3118. \def\activedoublequote{{\tt \char '042}}
  3119. \let"=\activedoublequote
  3120. \catcode`\~=\active
  3121. \def~{{\tt \char '176}}
  3122. \chardef\hat=`\^
  3123. \catcode`\^=\active
  3124. \def^{{\tt \hat}}
  3125.  
  3126. \catcode`\_=\active
  3127. \def_{\ifusingtt\normalunderscore\_}
  3128. % Subroutine for the previous macro.
  3129. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  3130.  
  3131. % \lvvmode is equivalent in function to \leavevmode.
  3132. % Using \leavevmode runs into trouble when written out to
  3133. % an index file due to the expansion of \leavevmode into ``\unhbox
  3134. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  3135. % magic tricks with @.
  3136. \def\lvvmode{\vbox to 0pt{}}
  3137.  
  3138. \catcode`\|=\active
  3139. \def|{{\tt \char '174}}
  3140. \chardef \less=`\<
  3141. \catcode`\<=\active
  3142. \def<{{\tt \less}}
  3143. \chardef \gtr=`\>
  3144. \catcode`\>=\active
  3145. \def>{{\tt \gtr}}
  3146. \catcode`\+=\active
  3147. \def+{{\tt \char 43}}
  3148. %\catcode 27=\active
  3149. %\def^^[{$\diamondsuit$}
  3150.  
  3151. % Used sometimes to turn off (effectively) the active characters
  3152. % even after parsing them.
  3153. \def\turnoffactive{\let"=\normaldoublequote
  3154. \let~=\normaltilde
  3155. \let^=\normalcaret
  3156. \let_=\normalunderscore
  3157. \let|=\normalverticalbar
  3158. \let<=\normalless
  3159. \let>=\normalgreater
  3160. \let+=\normalplus}
  3161.  
  3162. % Set up an active definition for =, but don't enable it most of the time.
  3163. {\catcode`\==\active
  3164. \global\def={{\tt \char 61}}}
  3165.  
  3166. \catcode`\@=0
  3167.  
  3168. % \rawbackslashxx output one backslash character in current font
  3169. \global\chardef\rawbackslashxx=`\\
  3170. %{\catcode`\\=\other
  3171. %@gdef@rawbackslashxx{\}}
  3172.  
  3173. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  3174. {\catcode`\\=\active
  3175. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  3176.  
  3177. % \normalbackslash outputs one backslash in fixed width font.
  3178. \def\normalbackslash{{\tt\rawbackslashxx}}
  3179.  
  3180. % Say @foo, not \foo, in error messages.
  3181. \escapechar=`\@
  3182.  
  3183. % \catcode 17=0   % Define control-q
  3184. \catcode`\\=\active
  3185.  
  3186. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  3187. % That is what \eatinput is for; after that, the `\' should revert to printing 
  3188. % a backslash.
  3189. %
  3190. @gdef@eatinput input texinfo{@fixbackslash}
  3191. @global@let\ = @eatinput
  3192.  
  3193. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  3194. % the first `\{ in the file would cause an error. This macro tries to fix 
  3195. % that, assuming it is called before the first `\' could plausibly occur.
  3196. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  3197.  
  3198. %% These look ok in all fonts, so just make them not special.  The @rm below
  3199. %% makes sure that the current font starts out as the newly loaded cmr10
  3200. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  3201.  
  3202. @textfonts
  3203. @rm
  3204.  
  3205. @c Local variables:
  3206. @c page-delimiter: "^\\\\message"
  3207. @c End:
  3208.